Click here to Skip to main content
14,699,322 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Wanting to see the frequency (percentage) of an event that happens per month, per week, and per day using C# and WPF or Windows Forms. I originally asked for WPF; however, now it's not a big deal if it's one or the other. I would prefer C# though since that is the language I know better then any other language.

This part is my update version and below the line is my previous version. If I am not making sense, please let me know and I will try better at explaining the concept......


What I am looking for is a way to get a prediction of when a dog would bark the most throughout the day, week or month. If I have a record that shows that an event occurs 3 times during a week at 10 am and twice at 1 pm, and to track that event for one week would show that the dog barked 33.33% of the time at 10 am and 66% of the time at 1pm.

Now if the dog barked on Monday at 10 am and again at 1 pm then again on Wednesday at 1 pm that would change the percentage to not only 33% at 10 am, but would make Monday 66% of the barks. 

What I am not understanding is when trying to come up with a percentage how would someone take into account a day, week and month? What is difficult is thinking of the logic around the three percentages. I would like to get (day, week, month)
and if an event occurs on one day more then another day the percentage may be higher for the day with more events, but if a trend shows that Wednessday has more documented events throughout the month then Monday then Wednessday should have a higher frequency rate then Monday, even though Monday may have had more events then Wednesday. 

I am not sure if I am explaining this correctly and I am doing this from my phone so please ignore in correct spelling and improper sentences / words.

I am not asking for someone to write the code for me, as this is a personal project for my 7 year old daughter and I at home, however, the concept does not register completely to me and trying to come up with a workflow in my mind is a little over my knowledge of expertise on this. 



_________________________________________________


30 days = 100% of a month
5 days a week = 100% of the week
8 hours in a day = 100% of the day
1 hour block = 100% of the block

So, let's say a dog barks 2 times a day on Monday and Wednesday at 11 am and 1 pm. Then the dog barks on Thursday of the next week at 10am Then the next week the dog barks on Monday, Tuesday and Thursday at 9 am, 10 am and 2pm. How would I find the percentage per day, week and month of the dark barking to know which times and days are more predictive that the dog may bark? So in other words, the times may be random, but over a month time come up with a percentage of each time and day.

What I have tried:

I know how to come up with a percentage, but figuring the frequency over a day, week and month is too in depth for me.
Posted
Updated 10-Apr-18 4:04am
v2

Well first, there aren't always 30 days in a month, there are 7 days in a week, 24 hours in a day, and 60 minutes in an hour. How you came up with your "windows" of time is kinda - well - absurd.

Second, you're trying to predict when a dog will bark based on past performance. A dog just doesn't bark on a whim. There is an external causation that compels the dog to bark, I.E. the mailman delivering the mail, a neighborhood stray strolling by, or even a squirrel taunting the dog from a nearby fence. NONE of these things are really that predictable (except possibly the squirrel).

This has nothing really to do with calculating percentages, but predicting future actions based on statistical analysis of randomly occurring past events.

Finally, if the dog barks and there's nobody there to hear it, or if there is and they aren't aware that they're supposed to make note of it, how do you know it did or didn't happen?

All of the above has convinced me that your user story is highly flawed and implausible, and therefore cannot be supported with code. Now, if you'll excuse me, my dogs are barking, and I have to go see what all the ruckus is about (my guess is some other form of wildlife, such as neighbors, deer, squirrel, or stray dog).
   
v4
To add to what John says, you are confusing "time" with "period" and "cause" with "effect".
Dog's do not know what day of the week it is: they don't (as far as we know) have any real sense of a time period greater than "day" because that fits a natural biorhythm cycle - it gets dark, they sleep. They are used to being fed at "human get up time" and "human eat food time".
So their barking - unless it happens for the same reason each time isn't predictable to a "Monday" or a "Thursday" because they don't bark on specific days, they react (the effect) to something in their environment which makes them feel the need to alert the pack / warn off others (the cause). That cause may be different for each time the dog barks for the entirety of it's life, or if maybe - as John suggests - the Postman making his rounds at the same time each day. You can't accurately predict unless the data your are predicting from has some actually correlation, and you know what that correlation is.

But it's easy enough to do if a little pointless: just record the event time and then "bracket it" into your desired periods. Put all the "Monday barks" together, all the "Tuesday barks" together, all the ... you get the idea. Count the barks for each day, and you can work it out as a percentage just by dividing the count per day by the total barks, and multiplying by 100. The same process works for all other periods.

Probably won't be any use to you though...
   
Comments
#realJSOP 8-Apr-18 11:25am
   
Modern coursework rarely - if ever - has practical uses.
Quote:
Wanting to see a trend of what percentage something happens per month, per week, and per day using C# and WPF.

The whole statement is meaningless. It happily mix different things that are not related.
A bark is an event, but to get a percentage of bark in a day, you need a duration.
Quote:
I know how to come up with a percentage, but figuring in depth over a day, week and month is too in depth for me.

Short answer: you can't know because it makes no sense.
It is the same as getting the percentage of the day you are drinking, knowing that you drink 4 times a day.

This not a programming problem, it is a problem of logic, or lack of logic.
   
v3
Comments
Member 12719658 9-Apr-18 0:22am
   
Thank you for your reply; however, I may have not explained it correctly or you do not undertand what I wrote. Instead of saying I have a lack of logic why don't you instead ask if I could be more clear? Otherwise, please do not reply at all.

I understand a bark is an event, but my statement is not meaningless and it has logic that makes perfect sense.

What I am looking for is a way to get a prediction of when a dog would bark the most throughout the day, week or month. If I have a record that shows that an event occurs 3 times during a week at 10 am and twice at 1 pm, and to track that event for one week would show that the dog barked 33.33% of the time at 10 am and 66% of the time at 1pm. This, to me, is perfect programming logic.

Now if the dog barked on Monday at 10 am and again at 1 pm then again on Wednesday at 1 pm that would change the percentage to not only 33% at 10 am, but would make Monday 66% of the barks.

What I am not understanding is when trying to come up with a percentage how would someone take onto account a day, week and month?
Patrice T 9-Apr-18 4:59am
   
Use Improve question to update your question.
So that everyone can pay attention to this information.

Indeed, not the same question, I think the missing word is 'frequency'
Sorry I asked a question on here so people can critic my reasonings and tell me that what I want to do is pretty much stupid. I thought code project was more of an advanced site where people were more apt to help instead of put down other peoples ideas. My reasonings are for a specific reason and I hate to say, but the responses I received I could have gotten from my child's 3rd grade class. I never asked if anyone can critic my idea and tell me what they thought about it; however, it looks like people like to hide behind the internet and voice a response to make themselves feel cool about themselves.

If I did not ask the question clear enough it would have been more appropriate to ask for more details instead of the inappropriate responses I received. I am not out to make a world wide software product, instead, do something for my child that she has asked to do. A dog barking is for our dog and she wanted to an analysis of her own for her own interest. Thanks for the critics and irrational responses, but apparently I will need to make sure the question sounds like gold to get a more mature reply.
   
Comments
F-ES Sitecore 9-Apr-18 7:20am
   
People are pulling your leg. No-one answered your question because we don't do people's homework for them because it means they've learned nothing, and that's why you shouldn't be doing your child's homework either. There's nothing wrong with guiding but doing someone's work does not help that person learn.
Member 12719658 9-Apr-18 7:43am
   
I am 45 years old, full time job and not going to school. My daughter is 7 years old. There was no "guiding" involved, but complete put downs. I never took coding when I went to school and I am sure schools these days dont ask for a project about dogs barking. I will just tell my daughter to write everything down and we can try to figure out the percentage and math on paper. Assuming is not the correct way to reply to a person question.
Patrice T 9-Apr-18 8:27am
   
To discuss with someone, use the button 'Reply' on right of user name, on top of message.
Advantage, the user is notified.
Patrice T 9-Apr-18 8:37am
   
You sent me a message with informations that are not in the question, it happen that your message makes much more sense than the question. that is the reason I told you to update the question.

As you ask for help, it is your task to give proper informations. We can't guess that you kept half of the interesting information for you, and we don't beg for it.
Your question makes no sense, the answers are accordingly to the question.

You are unhappy, too bad for you.
Maciej Los 9-Apr-18 8:46am
   
Well, i understand that you feel bitter about community reponses. Note that we can't read in your mind or direct from your screen. I'd suggest to move that content to your question (use Improve question widget) and remove that "answer", because it's not proper solution.
I'll try to answer your question soon.
Member 12719658 10-Apr-18 0:03am
   
I will use the improve question widget and move my response. I am sorry that my original question did not make sense; however, it did in my mind at that time. To have the responses that I had were totally immature and people that want to reply and just make statments like "You are unhappy, too bad for you" is just ignorant. I would think if a question is not concrete enough to understand a simple, "Can you supply more information because it is unclear why you are asking" is far more respected then an insult or childhood drama. Maybe 3 tours in Afghanistan made me see differently and I cannot see the humor behind their reaponses, but it just seems irresponsible and not very professional from someone that wants to call themselves a professional.

Thank you and I will "improve my question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900