Algorithm for finding trends in data? [closed] - java

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 9 years ago.
Improve this question
I'm looking for an algorithm that is able to find trends in large amounts of data. For instance, if one is given time t and a variable x, (t,x), and given input such as {(1,1), (2,4), (3,9), (4,16)}, it should be able to figure out that the value of x for t=5 is 25. How is this normally implemented? Do most algorithms compute lines of best fit that are linear, quadratic, exponential, etc. and then chooses the line of best fit with the lowest standard deviation? Are there other techniques for finding trends in data? Also, what happens when you increase the number of variables to analyze large vectors?

This is a really complex question, try to start from: http://en.wikipedia.org/wiki/Interpolation

There is no simple answer for a complex problem: http://en.wikipedia.org/wiki/Regression_analysis

A Neural network might be a good candidate. Especially if you want to learn it something nonlinear.

Related

Run a math expression from string in java [closed]

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 5 years ago.
Improve this question
I want to know if there is any efficient method to Run a math expression from string in java , Having some example input and results of that function.
Starting from simple linear functions : a*x+b .To more complex ones
Or is there any good source i can start reading.
I take your task as: take observed input-output and learn some representation which is able to do that transformation with new inputs.
(Some) Neural Networks can learn an approximation-function (Universal approximation theorem
) (and probably other approaches), but there is something important to remark:
Without assumptions about your function (e.g. smoothness), there can't be an algorithm achieving what you want to do! Without assumptions there are infinite many approximation-functions, which are all equally good on your examples, but behave arbitrarily different on new data!
(I'm also ignoring special-cases as: random-data or cryptographic random-generators where this mapping also can't be learned (the former in theory; the latter at least in practice)

How to approach probability type of programming challenge? [closed]

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 8 years ago.
Improve this question
You're dealt 17 cards from a 52-card deck. On average, what is the longest straight flush you will have in your hand?
A straight flush is a set of cards that are consecutive, and also of the same suit. 2 is low, Ace is high, and you cannot wrap around. Do not solve this mathematically — create a program that approximates this.
I'm not able to think about the correct approach for this type of question. Is there any type of algorithm I have to apply?
This is an example of what's called a "Monte Carlo" program, after the casino resort. The idea is to just try a random process a whole bunch of times and look at the statistics.
Basically, you should write a program that deals 17 cards from the deck and counts the longest straight flush. Then you call that a lot of times (maybe 10,000 or 100,000) and take the average.

Fixed length array vs fields [closed]

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 9 years ago.
Improve this question
What is faster?
I want to write an API for processing and calculating with vectors and matrices.
A "Matrix4f" needs 4*4 float values.
Should i write this as 16 fields or a two-dimensional array?
But if i use fields, inheritance is impossible.
This is more a question of maintainability than speed. The speed difference between your two alternatives will almost certainly not be noticeable. The array approach, however, makes more sense in terms of what you are trying to model, and it's simply easier to deal with (say, for instance, you want to create a 5x5 matrix instead, then your array code will be easily reusable whereas your code with 16 fields would require drastic modifications). In short, don't worry about speed when making this decision, worry instead about what makes more sense and what will be easier to manage down the line; then the choice should be clear.
There is no complexity in accessing an array nor in accessing a variable, O(1) so to say.
This is not what you should consider in speed, but your actual algorithms and functions.

Mapping algorithm of subjects [closed]

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 9 years ago.
Improve this question
I am trying to make a system that assesses students' exams to learn their weaknesses. The exam consists of all subjects on their syllabus.
How do I --
Measure the skill of a student based on his/her score on the exam
Extract from the exam the topics on which the student performed poorly
My question is what algorithm should I use to map the syllabus based on the incorrect answers. Please help me. I'm new to this.
Update:
The input would be their exam with their answer and the output would be their knowledge level and suggestion of which topic should they study more
If you need more information please ask, i really need to know what algorithm should i use.
A simple system consists of tagging each question with one or more topics, then tallying the correct answers, sort by percentage, and output e.g. You got 3/8 (38%) of StackOverflow questions right
I notice you haven't tagged a specific language, so I'll outline the way I would do it in Python.
Could you not have a dict (this is composed of a a key - this could be the subject, and a corresponding value - this could be the exam result).
You could then sort the dict by values, in order from high to low. The best subjects would be at the top and the worst at the bottom.
If you're not using Python, you could use the Map type from C++ instead.

My own code vs library [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
This is kind of unusual question for developers but for some reason i want to post it here and hope to get adequate answer.
Here is a simple example:
I wrote a java function that calculates distance between two geo points. The function is not more than 50 lines of code. I decided to download a source code from ibm that does the same thing but when i opened it i saw that it looks very complicated and is almost thousand lines of code.
What kind of people write such source code? Are they just very good programmers? Should i use their source code or my own?
I have noticed this kind of thing lots of times and i from time to time i start to wonder if it is just me who do not know how exactly to program or maybe i am wrong?
Do you guys have the same kind of feeling when you browse throught some other peoples source code?
The code you found, does it do the exact same calculation? Perhaps it takes into account some edge cases you didn't think of, or uses an algorithm that has better numerical stability, lower asymptotic complexity, or is written to take advantage of branch prediction or CPU caches. Or it could be just over-engineered.
Remember the saying: "For every complex problem there is a solution that is simple, elegant, and wrong." If you are dealing with numerical software, even the most basic problems like adding a bunch of numbers can turn out to be surprisingly complex.

Categories