Package CHEM :: Package ML :: Module FeatureRegression :: Class FeatureRegression
[hide private]
[frames] | no frames]

Class FeatureRegression



Given a list of feature dictionaries (sparse feature vectors) representing different objects and a matching list of target values to predict, assign values to each feature encountered to best predict the target values.

Ultimately, this essentially gets laid out as a system of linear equations where the value of the feature vectors represents the coefficients of the equations and the target values are the equation solutions. The problem then is to just find the set of unknown variable values which solves the system with the minimal error.

Instance Methods [hide private]
 
__init__(self)
Default constructor.
 
main(self, argv)
For use as command-line executable method
 
regressionByFilenames(self, featureDictFilename, featureValueFilename, targetValueFilename)
Simple wrapper around regression method, just to open up files
 
writeFeatureValueDict(self, featureValueDict, featureValueFile)
Write out the contents of the featureValueDict to the featureValueFile.
 
predictionByFilenames(self, featureDictFilename, featureValueFilename, targetValueFilename)
Simple wrapper around prediction method, just to open up files
 
readFeatureValueDict(self, featureValueFile)
Read the contents of the feature value file, probably generated by this classes regression method, back into a dictionary.
 
regression(self, featureDictList, targetValueList)
Primary regression method: Given a list over all of the input object feature dictionaries (or just using a FeatureDictReaderFactory) and a list of the targetValues, find the optimal solution for the "value" of each feature contributing to the total target values.
 
prediction(self, featureDictList, featureValueDict)
Primary prediction method (reciprocal function of regression): Given a list over all of the input object feature dictionaries and a dictionary mapping features to their "value," generate predicted values for the "total" targetValue of each input feature dictionary.
 
predictionSingle(self, featureDict, featureValueDict)
Generate a single prediction by going over all of the features in the feature dictionary and looking up values to sum over in the featureValueDict.
Method Details [hide private]

writeFeatureValueDict(self, featureValueDict, featureValueFile)

 
Write out the contents of the featureValueDict to the featureValueFile. Pretty simplistic now, assume the feature is a string with no spaces, and that value's natural string conversion is acceptable.

regression(self, featureDictList, targetValueList)

 

Primary regression method: Given a list over all of the input object feature dictionaries (or just using a FeatureDictReaderFactory) and a list of the targetValues, find the optimal solution for the "value" of each feature contributing to the total target values.

Return the solutions as a dictionary mapping features to their respective values;