mercredi 23 mars 2016

How to find the most commonly repeated set of double's in a text file? -Java

I have a text file with several hundred doubles separated by line breaks:

Ex: -0.020000000000010232 0.09500000000001307 -0.05500000000000682 0.1599999999999966 0.07000000000000739 -0.0799999999999983 -0.07000000000000739 0.060000000000002274 0.04000000000000625 0.04999999999999716 -0.10000000000000853 ...

For further context, I'm trying a super simple version of the application of machine learning to stocks, where derivative series of differences in price are dumped in a text file. The program, whilst constantly updating the "top three" patterns, will attempt to reference a pattern whenever it sees similar derivative values to predict future changes. Less relevantly, several other heuristics considering both volatility and volumes are also included in the refinement of these patterns.

The first part of this is finding/guessing basic patterns from the text file. I have two questions here:

Q1: How do I round off these values to the fourth decimal point? (0.0001)

Q2: How do I find the three most commonly repeated sets of rounded doubles and write them to a separate text file?

Aucun commentaire:

Enregistrer un commentaire