public void CompileConvergentSeries() { //alle producten /* * y is waarde product * x = aantal iteraties */ foreach (Agent a in Agents) { foreach (Product p in a.Products) { ScatterPoint sca = new ScatterPoint(CurrentIteration, p.Value, 3.0, 10.0, p.ID); var aa = new List <ScatterPoint>(); aa.Add(sca); var series = new OxyPlot.Wpf.ScatterSeries { TrackerFormatString = "X: " + CurrentIteration + Environment.NewLine + "Y: " + p.Value + Environment.NewLine + "PID: " + p.ID + Environment.NewLine + "Agent: " + a.Name + Environment.NewLine + "Origin: " + p.NameOfOriginAgent + Environment.NewLine + "Color: " + GeneratedColors[p.ID].ToString(), Color = GeneratedColors[p.ID], //de kleuren zijn steeds anders... MarkerFill = GeneratedColors[p.ID], }; DivergenceConvergencePlot.Series.Add(series); series.ItemsSource = aa; series.Tag = p.ID; } } }
public void DrawNetwork(List <NetworkLayer> layers) { List <ScatterPoint> previousLayerPoints = new List <ScatterPoint>(); for (int l = 0; l < layers.Count; l++) { NetworkLayer layer = layers[l]; OxyPlot.Wpf.ScatterSeries series = new OxyPlot.Wpf.ScatterSeries(); series.MarkerType = OxyPlot.MarkerType.Circle; series.MarkerSize = 5; OxyPlotControl.Series.Add(series); ObservableCollection <ScatterPoint> points = new ObservableCollection <ScatterPoint>(); for (int i = 0; i < layer.NeuronsNumber; i++) { OxyPlot.Wpf.LineSeries lineSeries = new OxyPlot.Wpf.LineSeries(); lineSeries.Color = Color.FromArgb(128, 78, 97, 102); lineSeries.StrokeThickness = 1; lineSeries.DataFieldX = "X"; lineSeries.DataFieldY = "Y"; lineSeries.MarkerSize = 0; lineSeries.LineStyle = OxyPlot.LineStyle.Solid; OxyPlotControl.Series.Add(lineSeries); double x = schemaHeight - l * (schemaHeight / (double)layers.Count); double y = schemaWidth - i * (schemaWidth / (double)layer.NeuronsNumber); points.Add(new ScatterPoint(x, y)); ObservableCollection <NeuronDataPoint> linePoints = new ObservableCollection <NeuronDataPoint>(); foreach (var previousLayerPoint in previousLayerPoints) { linePoints.Add(new NeuronDataPoint(x, y, 5.5)); linePoints.Add(new NeuronDataPoint(previousLayerPoint.X, previousLayerPoint.Y, 5.5)); } lineSeries.ItemsSource = linePoints; lineSeries.TrackerFormatString = "Waga: {Weight}"; } previousLayerPoints = new List <ScatterPoint>(points); series.ItemsSource = points; series.TrackerFormatString = ""; } OxyPlotControl.InvalidatePlot(true); OxyPlotControl.IsLegendVisible = false; }
private void DisplayIfTwoDimensional(StandardTrainingObserver sno) { if (Network.Dimensions == 2) { if (SingleSeriesCheckBox.IsChecked == true) { List <OxyPlot.Wpf.Series> moving = View.Utility.Converter.ConvertToScatterSeries(sno.HistoryOfNeurons); var scattersData = new List <ScatterPoint>(); foreach (var train in TrainingData) { var x = train.At(0); var y = train.At(1); scattersData.Add(new ScatterPoint(x, y)); } var stat = new OxyPlot.Wpf.ScatterSeries { ItemsSource = scattersData, Title = $"Training points", MarkerSize = 2, MarkerFill = Color.FromRgb(140, 131, 130) }; ChartWindow chw1 = new ChartWindow(stat, moving); chw1.Show(); } if (MultipleSeriesCheckbox.IsChecked == true) { List <List <OxyPlot.Wpf.Series> > series = new List <List <Series> >(); List <List <Vector <double> > > history = Network.Observer.HistoryOfNeurons; for (int j = 0; j < history.Count; j++) { var epoch = history[j]; if (j % 4 == 0) { List <OxyPlot.Wpf.Series> group = new List <Series>(); Dictionary <Neuron, List <Vector <double> > > neuronZones = new Dictionary <Neuron, List <Vector <double> > >(); int i = 0; foreach (var neuron in Network.Neurons) { neuronZones.Add(neuron, new List <Vector <double> >()); neuron.CurrentWeights = epoch[i]; i++; } foreach (var data in TrainingData) { neuronZones[Network.GetWinner(data)].Add(data); } foreach (var neuronZone in neuronZones) { var scatterSet = new List <ScatterPoint>(); scatterSet.Add( Converter.ConvertVectorToScatterPoint(neuronZone.Key.CurrentWeights, true)); var points = neuronZone.Value; foreach (var point in points) { scatterSet.Add(Converter.ConvertVectorToScatterPoint(point)); } group.Add(new OxyPlot.Wpf.ScatterSeries { ItemsSource = scatterSet, Title = $"Class", MarkerSize = 3 }); } series.Add(group); } } ChartWindow chw2 = new ChartWindow(series); chw2.Show(); } } }