/// <summary> /// Creates a new instance of the learning algorithm for a given /// Markov sequence classifier using the specified configuration /// function. /// </summary> /// public SequenceClassifierLearning(SequenceClassifier <TDistribution> classifier, ClassifierLearningAlgorithmConfiguration algorithm) : base(classifier, algorithm) { }
private void loadAllModels(string modelDirectoryName) { if (Directory.Exists(modelDirectoryName)) { // Get all files of type .rec in the directory string[] files = Directory.GetFiles(modelDirectoryName, "*.dat"); this.positionModels = new List<HiddenMarkovModel<MultivariateNormalDistribution>>(); this.jointModels = new List<HiddenMarkovModel<MultivariateNormalDistribution>>(); this.positionClasses = new List<string>(); this.jointClasses = new List<string>(); foreach (string s in files) { string actName = Path.GetFileNameWithoutExtension(s); // strip off the hmm_ from the beginning actName = actName.Substring(4); bool isJointAction = Util.shouldUseJVals(actName); // Deserialize the model and add it to the correct classifier SerializableHmm serMod = new SerializableHmm(actName, modelDirectoryName); HiddenMarkovModel<MultivariateNormalDistribution> hmm = serMod.LoadFromDisk(); if (isJointAction) { jointModels.Add(hmm); jointClasses.Add(actName); } else { positionModels.Add(hmm); positionClasses.Add(actName); } } jointActionClassifier = new SequenceClassifier<MultivariateNormalDistribution>(jointModels.ToArray()); positionActionClassifier = new SequenceClassifier<MultivariateNormalDistribution>(positionModels.ToArray()); // TODO(pbrook) if there is time we should add a threshold model to these SequenceClassifiers } }