annotate hackday/DynamicBayesianArray.h @ 36:5a1b0c6fa1fb

Added class to read in the csv Annotation file, then write out the respective difference between the performed piece as followed here, and the annotation of RWC by Ewert and Muller
author Andrew N Robertson <andrew.robertson@eecs.qmul.ac.uk>
date Thu, 15 Dec 2011 02:28:49 +0000
parents 49a5b023df1e
children
rev   line source
andrew@28 1 /*
andrew@28 2 * DynamicBayesianArray.h
andrew@28 3 * midiCannamReader
andrew@28 4 *
andrew@28 5 * Created by Andrew on 17/07/2011.
andrew@28 6 * Copyright 2011 QMUL. All rights reserved.
andrew@28 7 *
andrew@28 8 */
andrew@28 9
andrew@28 10 /*
andrew@28 11 * DynamicBayesianArray.cpp
andrew@28 12 * bayesianTest5
andrew@28 13 *
andrew@28 14 * Created by Andrew Robertson on 08/05/2010.
andrew@28 15 * Copyright 2010 __MyCompanyName__. All rights reserved.
andrew@28 16 *
andrew@28 17 */
andrew@28 18
andrew@28 19 /*
andrew@28 20 * DynamicBayesianArray.h
andrew@28 21 * bayesianTest5
andrew@28 22 *
andrew@28 23 * Created by Andrew Robertson on 08/05/2010.
andrew@28 24 * Copyright 2010 __MyCompanyName__. All rights reserved.
andrew@28 25 *
andrew@28 26 */
andrew@28 27
andrew@28 28 #include "ofMain.h"
andrew@28 29
andrew@28 30 #include "DynamicVector.h"
andrew@28 31
andrew@28 32 #ifndef _DYNAMIC_BAYESIAN_ARRAY
andrew@28 33 #define _DYNAMIC_BAYESIAN_ARRAY
andrew@28 34
andrew@28 35 #define ARRAY_SIZE 240
andrew@28 36
andrew@28 37
andrew@28 38 class DynamicBayesianArray{
andrew@28 39
andrew@28 40 public:
andrew@28 41
andrew@28 42 DynamicBayesianArray();
andrew@28 43 void initialiseArray();
andrew@28 44
andrew@28 45 // void setGaussianLikelihoodForBeats(float mean, float StdDev);
andrew@28 46 void setGaussianLikelihood(float mean, float StdDev);
andrew@28 47 void setGaussianPrior(float mean, float StdDev);
andrew@28 48 void setGaussianPosterior(float mean, float StdDev);
andrew@28 49
andrew@28 50 void calculatePosterior();
andrew@28 51 void renormalisePosterior();
andrew@28 52 void resetMaximumPosterior();//resets the max index
andrew@28 53 void decayPosteriorWithGaussianNoise();
andrew@28 54 void translateDistribution(int translationIndex);
andrew@28 55 void setDecayNoiseGaussian(float mean, float StdDev);
andrew@28 56 double calculateStandardDeviation();
andrew@28 57
andrew@28 58 int arraySize;
andrew@28 59
andrew@28 60
andrew@28 61 float getMaximum(float *ptr, int length);
andrew@28 62 void renormaliseArray(float *ptr, int length);
andrew@28 63 void resetPrior();
andrew@28 64 void decayPosterior();
andrew@28 65 float* getMaximumEstimate(float *ptr, int length);
andrew@28 66 double getMaximumIndex();//return the index where the probability is maximal
andrew@28 67 double getIntegratedEstimateIndex();
andrew@28 68
andrew@28 69 // void drawArray(const int& minIndex, const int& maxIndex);
andrew@28 70 void drawFloatArray(float* arrayToDraw, const int& minIndex, const int& maxIndex);
andrew@28 71 void drawDoubleArray(double* arrayToDraw, const int& minIndex, const int& maxIndex);
andrew@28 72
andrew@28 73
andrew@28 74 typedef std::vector<double> DoubleVector;
andrew@28 75 // typedef std::vector<IntVector> DoubleMatrix;
andrew@28 76
andrew@28 77
andrew@28 78 // DynamicVector prior;
andrew@28 79 // DynamicVector posterior;
andrew@28 80 // DynamicVector likelihood;
andrew@28 81
andrew@28 82 DynamicVector testVector;
andrew@28 83 // DynamicVector prior;
andrew@28 84
andrew@28 85 float prior [ARRAY_SIZE];
andrew@28 86 float posterior [ARRAY_SIZE];
andrew@28 87 float likelihood [ARRAY_SIZE];
andrew@28 88 float tempPosteriorArray[ARRAY_SIZE];
andrew@28 89
andrew@28 90 float decayNoiseArray[ARRAY_SIZE];
andrew@28 91 float decayNoiseStdDev, decayNoiseAmount;
andrew@28 92
andrew@28 93 float likelihoodMean, likelihoodStdDev, likelihoodNoise;
andrew@28 94 float maximumTest, posteriorDecayRate, maximumValue;
andrew@28 95 float eighthNoteProportion, earlySixteenthNoteProportion, lateSixteenthNoteProportion ;
andrew@28 96 float maximumEstimate, maximumIndex, integratedEstimate;
andrew@28 97 double standardDeviation;
andrew@28 98
andrew@28 99 private:
andrew@28 100 };
andrew@28 101
andrew@28 102 #endif
andrew@28 103
andrew@28 104
andrew@28 105