Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Hey guys I'm playing around with a personal project I'm making as I'm new to clojure, its measuring football players performance.
This is the a partial example of the data I am using
:Performance 2019, :Day 1, :CR7 43, :Messi -2,
:Performance 2019, :Day 2, :CR7 12, :Messi 6,
:Performance 2019, :Day 3, :CR7 -11, :Messi 4,
:Performance 2019, :Day 4, :CR7 4, :Messi 32,
:Performance 2019, :Day 5, :CR7 21, :Messi -48,
The years in the data that I'm using go back to around 2010 and the days go upto 31, It would have been to much to put here so I included a sample. The numbers next to the players CR7 and Messi are personal performance indicators that I have given them. There's less players for now but over time I will add more.
Ive stored the data in a zipmap like so
(zipmap [:Performance :Day :CR7 :Messi
My question is how would you add up all the ratings for each player from the 31 days and work out their highest performing year, bare in mind the years go back to 2010-2020
You can make the problem more tractable by re-shaping the data to avoid mixing program-logic keys (:Performance and :Day) with data ("CR7" and "Messi" for now).
For example, you could state the database as a list of assertions:
[{:performance 2019 :day 3 :player "CR7" :rating -11}
{:performance 2019 :day 3 :player "Messi" :rating 4}
...]
Conveniently, you could source that data from a CSV file, making it easy to add facts about more players without revising the column structure of the data.
Computationally, you face two challenges. 1) For each player, for each year, sum the ratings. 2) For each player, harvest the year of the highest rating.
The result of challenge No.1 is probably a map of player to (map of year to sum of ratings). Like this:
{"CR7" {2018 44, 2019 73, 2020 81}
"Messi" {2018 32, 2019 11, 2020 6}}
To get there, you need to transform a list (of assertions) to a single thing (a map of player to years' ratings). A Clojure standard-library function that transforms a list to a single thing is reduce. With each input record (one year, one day, one player, one rating) you update the reduction by adding the rating to one counter. The standard-library function update-in will be just the ticket.
For challenge No.2, you want the year with the highest rating. The standard-library function max-key could be helpful there.
Related
I am a complete to newbie to machine learning but I am trying to achieve following:
I have a series of data, let's say:
ie:
[ {'day1', 5}, {'day2', 3}, {'day3', 8} ... {'day100', 8}]
that at the end has a final result:
ie: pass/fail/other result
I would like to predict the most likely end result by using a partial set of data
ie: [{'day1', 3}, {'day2', 1}, {'day3', 6} ... {'day50', 8}]
What would be the best way to achieve this and if possible, do you have any examples or hint of where to look into that could help someone like me with no experience in machine learning
It is a time series prediction.
I'd suggest you check if your time series contain trend or seasonality. Then try conventional methods of time-series prediction as moving average (or sliding window) when you, for example, predict day 6 based on days 1-5, then day 7 based on days 2-6 etc. You may also try Exponential Smoothing and ARIMA.
Concerning ml.net, the following tutorial is the best solution for you
as it uses a Singular Spectrum Analysis and thus takes into consideration a trend and possible seasonality to forecast values. You can employ it by using
ssaforecastingestimator: put window = 25 and horizon=1 if you want to use the first 25 days to predict the value for day 26 (prediction one step forward). I suggest you take a smaller window though (5-7 days).
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Use the following data when building tables.
32, 64, 8, 23, 60, 47, 62, 59, 15, 29
Ans:
32-2
64-4
8-8
23-8
60-0
47-2
62-2
59-14
15-0
29-14
I understand the answers up to 23 because I can figure out how the answer is 8. My question is, how is 23%10 = 8? This also goes for the answers of 47, 59, and 29.
If it is even, calculate % 10
If it is odd, calculate % 15
This is the pattern that you should follow. Next time clarify and explain clearly to get better responses.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am completely stuck / lost. I need to write a program that will tell a user what month it will be in x amount of months from March. I need a point in the right direction to start me off.
I am still learning c++, so I'm trying to keep it as basic as possible. Any help will be a lifesaver !!
Example:
User enters 6, the result would display September.
User enters 239, the result would be February.
Just get the input % 12 and add it to March . For example in case of 239 :
239 % 12 = 11 ---> 11 months after march is february.
Logic : there are 12 months in an year. So march will again come in a cycle of 12.
Now so n/12 years will pass as it is. So after n/12 years you will be again at march. After that only n%12 months remain. So you can add them up directly to get your answer.
This question already has answers here:
How to code the maximum set packing algorithm?
(2 answers)
Closed 8 years ago.
Given N different candies and M children. Each of the children demands for K[i] different candies and will only be happy iff he get all those different candies which he demanded.
Now I want to maximize the number children that get happy. How should I distribute the candies?
Example: Let's have N=4 candies and M=3 children:
1st child requires 2 (K[1]) candies which are: 1 and 2
2nd child requires 2 (K[2]) candies which are: 2 and 3
3rd child requires 2 (K[3]) candies which are: 3 and 4
The answer here is 2 as I can at best only make the 1st and 3rd child happy.
My attempt:
Give candies to children in the order of the amounts that they require to be happy (i.e. K[i]). In other words, you should only give candy to a child if you have made happy all the children that demand less, and every time you give candy to one of them you have to give them the whole amount that they require.
Is this solution correct?
Yes, you are wrong. Consider:
Wants candies 1, 2, 3, and 4.
Wants candies 1, 5, 6, 7, 8, and 9.
Wants candies 2, 10, 11, 12, 13, 14, and 15.
Wants candies 3, 16, 17, 18, 19, 20, and 21.
Wants candies 4, 22, 23, 24, 25, 26, and 27.
Your algorithm will only make child 1 happy. But you can make 2, 3, 4, and 5 happy.
As this a problem in on-going programming contest i cannot give you much of an answer but will push you in right direction. The problem you are solving is np complete as it can be reduced to maximum independent set and hence it can only be solved in general case using brute force which is trying out all combinations. You can reduce computations by checking if new set added is not intersecting with the other in this way you can skip a lot of invalid combinations.
In an effort to create the fastest possible monte carlo texas hold'em hand analyzer with C++, I am currently looking into the subject of hand evaluation.
As many of you may know, there are quite a number of hand evaluators, open source, out there. After giving it some thought, I settled on the "Two Plus Two hand evaluator" (so named since it was first introduced on the two plus two forum).
This is one of the fastest known evaluators out there, and uses array lookups to quickly find the value of a hand.
Now, for the function, you need to pass in an array with the cards you are interested in. Example:
int Cards[] = { 3, 5, 10, 17, 23, 24, 32 };
int hv = HandValue(Cards);
With values between 1 and 52. Now, my question is: What cards do these integers correspond to? Is a 3 an ace of spades? A three of hearts? I have scoured google, the two + two forum, various pages where hand evaluators are presented, the source file for the build-up of the array. All in vain. So I am hoping that someone here can point me in the right direction of where I can find this information, or give it to me outright.
The source where the evaluators are taken from is this excellent article: http://www.codingthewheel.com/archives/poker-hand-evaluator-roundup#cactus_kev
Which explains all the evaluators individually.
I didn't verify this, but it appears to be:
"2c": 1,
"2d": 2,
"2h": 3,
"2s": 4,
"3c": 5,
"3d": 6,
...
"kh": 47,
"ks": 48,
"ac": 49,
"ad": 50,
"ah": 51,
"as": 52
ref: https://github.com/chenosaurus/poker-evaluator/blob/master/lib/PokerEvaluator.js