com.fisincorporated.stockanalysis
Class StockImager

java.lang.Object
  extended bycom.fisincorporated.stockanalysis.StockImager

public class StockImager
extends java.lang.Object

This class will accept a list of stocks, date and period ranges and create an 'image' file of (presumably) stock closes for use in Kohonen SOM NN

Author:
Eric Foertsch

Constructor Summary
StockImager()
           
 
Method Summary
 boolean[][] createImageArray(float[] data, int height)
          Creates 2D 'image' array for Joone NN.
 boolean[][] createImageArray(long[] data, int height)
          Creates 2D 'image' array
 java.lang.String getImageString(boolean[][] image)
          Takes a 2D boolean array and turns it into an 'image' string for NN
 java.lang.String getImageString(float[] data, int height)
          Create an 'image' string based on the data array given to it.
 java.lang.String getImageString(long[] data, int height)
          Same as prior getImageString but accepts array of long[]
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StockImager

public StockImager()
Method Detail

getImageString

public java.lang.String getImageString(float[] data,
                                       int height)
Create an 'image' string based on the data array given to it. The return string can be used as input to Joone Kohnen SOM The assumption is that the data array passed in is in chronological order from oldest (first point in array) to newest point (last point in array)

Parameters:
data - array of float
height - The 'height' of the image in 'pixels' Or think of height as providing % per pixel (100/height) eg. height = 50 then each pixel will represents 2% of height
Returns:
String - semicolon separated list of binary values for use in image recognition NN

getImageString

public java.lang.String getImageString(long[] data,
                                       int height)
Same as prior getImageString but accepts array of long[]

Parameters:
data -
height -
Returns:
String semicolon separated list of binary values for use in image recognition NN

getImageString

public java.lang.String getImageString(boolean[][] image)
Takes a 2D boolean array and turns it into an 'image' string for NN

Parameters:
image - Boolean[x][y]
Returns:
String of 1.0 (where b[x][y] is true), else 0.0 for NN. The boolean array is turned into string from the top down. eg b[0 ->x-1][y-1] , b[0->x-1][y-2] ... b[0->x-1][0]

createImageArray

public boolean[][] createImageArray(float[] data,
                                    int height)
Creates 2D 'image' array for Joone NN.

Parameters:
data - Points to be imaged. Length of array is number points on X axis
height - 'Height' of image. Number points on Y axis.
Returns:
2D array of boolean where a 'true' value represents a point on the image.

createImageArray

public boolean[][] createImageArray(long[] data,
                                    int height)
Creates 2D 'image' array

Parameters:
data - Points to be imaged. Length of array is number points on X axis
height - 'Height' of image. Number points on Y axis.
Returns:
2D array of boolean where a 'true' value represents a point on the image.