Changes

Jump to: navigation, search

GPU621/Jedd Clan

1,784 bytes added, 16:26, 11 August 2021
no edit summary
double* result = resultBlock.getBlockPtr();
</source>
 
[[File:TrainingPrediction.jpg]]
This image shows what has been created so far. The training has made a data model with the use of the features and responses and with that model the prediction is able to test new features and output a response based on
the training information.
 
 
== Implementation ==
For this example once again it required the use of polynomial regression which required the information to be expanded upon before training. After that is completed it would then be implemented similarly to above and a prediction model can be created once again.
 
<source lang=c++>
// Getting data from the source
FileDataSource<CSVFeatureManager> featuresSrc(trainingFeaturesFile,
DataSource::doAllocateNumericTable,
DataSource::doDictionaryFromContext);
featuresSrc.loadDataBlock(nTrnVectors);
 
// Creating a block object to extract data
BlockDescriptor<double> features_block;
featuresSrc.getNumericTable()->getBlockOfRows(0, nTrnVectors,
readOnly, features_block);
 
// Getting the pointer to the data
double* featuresArray = features_block.getBlockPtr();
 
// Expanding the data (see source for full implementation)
const int features_count = nFeatures*expansion*nTrnVectors;
double * expanded_tstFeatures = (double*) malloc(sizeof(double)*features_count);
expand_feature_vector(trnFeatures_block.getBlockPtr(), expanded_trnFeatures,
nFeatures, nTrnVectors, expansion);
 
// Repackaging the result into a numeric table
HomogenNumericTable<double> expanded_table(expanded_trnFeatures,
nFeatures*expansion, nTrnVectors);
trainingFeaturesTable = services::SharedPtr<NumericTable>(expanded_table);
</source>
 
[[File:TableValue.jpg]]
Shows the results of the reference vs the prediction for 1st - 3rd order expansions
 
[[File:TableValueGraph.jpg]]
The information plotted graphically
49
edits

Navigation menu