public void Learn_3statefullyconnectedgraph_aHMMfittedtothedata() { // Arrange int[] symbols = Enumerable.Range(0, 41).ToArray(); List<int[]> obs = new List<int[]>(); Random rnd = new Random(); for (int i = 0; i < 10; i++) { obs.Add(symbols.OrderBy(x => rnd.Next()).ToArray()); } SequenceData sd = new SequenceData(0); sd.AddSequences(obs); sd.SaveAddedSequences(); PadawanLearner pwl = new PadawanLearner(); pwl.Initialise(null, 0); // Act pwl.Learn(sd, null, null); //pwl.Learn(sd); double result = pwl.CalculateProbability(obs[2]); // Assert Assert.IsTrue(0.9 < result && result < 1.0); }
public Tuple<SequenceData, SequenceData> RandomSplit(int trainingDataSize, int validationDataSize, int randomSeed) { SequenceData trainingData = new SequenceData(NumSymbols); SequenceData validaitonData = new SequenceData(NumSymbols); List<int[]> shuffled = sequence_list.ToList(); Utilities.Shuffle(shuffled, randomSeed); trainingData.AddSequences(sequence_list.Take(trainingDataSize)); validaitonData.AddSequences(sequence_list.Skip(sequence_list.Count - validationDataSize).Take(validationDataSize)); trainingData.SaveAddedSequences(); validaitonData.SaveAddedSequences(); return new Tuple<SequenceData, SequenceData>(trainingData, validaitonData); }