/// <summary> /// Computes the Bag of Words model. /// </summary> /// /// <param name="images">The set of images to initialize the model.</param> /// <param name="threshold">Convergence rate for the k-means algorithm. Default is 1e-5.</param> /// /// <returns>The list of feature points detected in all images.</returns> /// public List <TPoint>[] Compute(Bitmap[] images, double threshold = 1e-5) { List <TFeature> descriptors = new List <TFeature>(); List <TPoint>[] imagePoints = new List <TPoint> [images.Length]; // For all images for (int i = 0; i < images.Length; i++) { Bitmap image = images[i]; // Compute the feature points var points = Detector.ProcessImage(image); foreach (IFeatureDescriptor <TFeature> point in points) { descriptors.Add(point.Descriptor); } imagePoints[i] = points; } TFeature[] data = descriptors.ToArray(); if (data.Length <= NumberOfWords) { throw new InvalidOperationException("Not enough data points to cluster. Please try " + "to adjust the feature extraction algorithm to generate more points"); } // Compute the descriptors clusters Clustering.Compute(data, threshold); return(imagePoints); }
public void JaccardIndexIsSane() { var clustering = Clustering.readClustering(@"..\..\TestData\act3_lab23_poseyxls_clustering_excelint.csv"); var correspondence = CommonFunctions.JaccardCorrespondence(clustering, clustering); Assert.AreEqual(1.0, CommonFunctions.ClusteringJaccardIndex(clustering, clustering, correspondence)); }
public double CalculateSimilarity(BagOfWords bag1, BagOfWords bag2, bool useLabels) { Clustering clustering = new Clustering(); double similarity = clustering.GetCosineDistance(bag1, bag2, useLabels); return(similarity); }
private static IEnumerable <TextLine> GetLines(List <Word> words, double maxDist, AngleBounds withinLine, int maxDegreeOfParallelism) { TextDirection textDirection = words[0].TextDirection; var groupedIndexes = Clustering.NearestNeighbours(words, 2, Distances.Euclidean, (pivot, candidate) => maxDist, pivot => pivot.BoundingBox.BottomRight, candidate => candidate.BoundingBox.BottomLeft, pivot => true, (pivot, candidate) => withinLine.Contains(Distances.Angle(pivot.BoundingBox.BottomRight, candidate.BoundingBox.BottomLeft)), maxDegreeOfParallelism).ToList(); Func <IEnumerable <Word>, IReadOnlyList <Word> > orderFunc = l => l.OrderBy(x => x.BoundingBox.Left).ToList(); if (textDirection == TextDirection.Rotate180) { orderFunc = l => l.OrderByDescending(x => x.BoundingBox.Right).ToList(); } else if (textDirection == TextDirection.Rotate90) { orderFunc = l => l.OrderByDescending(x => x.BoundingBox.Top).ToList(); } else if (textDirection == TextDirection.Rotate270) { orderFunc = l => l.OrderBy(x => x.BoundingBox.Bottom).ToList(); } for (var a = 0; a < groupedIndexes.Count; a++) { yield return(new TextLine(orderFunc(groupedIndexes[a].Select(i => words[i])))); } }
/// <summary> /// Gets the words. /// </summary> /// <param name="letters">The letters in the page.</param> /// <param name="maxDistanceFunction">The function that determines the maximum distance between two letters (start and end base line points), /// e.g. Max(GlyphRectangle.Width) x 20%. /// <para>If the distance between the two letters is greater, a new word will be created.</para></param> /// <param name="distMeasure">The distance measure between two letters (start and end base line points), /// e.g. the Manhattan distance.</param> /// <param name="filterPivotFunction"></param> /// <param name="filterFunction">Function used to filter out connection between letters, e.g. check if the letters have the same color. /// <para>If the function returns false, a new word will be created.</para></param> /// <param name="maxDegreeOfParallelism">Sets the maximum number of concurrent tasks enabled. /// <para>A positive property value limits the number of concurrent operations to the set value. /// If it is -1, there is no limit on the number of concurrently running operations.</para></param> private List <Word> GetWords(IReadOnlyList <Letter> letters, Func <Letter, Letter, double> maxDistanceFunction, Func <PdfPoint, PdfPoint, double> distMeasure, Func <Letter, bool> filterPivotFunction, Func <Letter, Letter, bool> filterFunction, int maxDegreeOfParallelism) { if (letters == null || letters.Count == 0) { return(new List <Word>()); } var groupedLetters = Clustering.NearestNeighbours(letters, distMeasure, maxDistanceFunction, l => l.EndBaseLine, l => l.StartBaseLine, filterPivotFunction, filterFunction, maxDegreeOfParallelism).ToList(); List <Word> words = new List <Word>(); foreach (var g in groupedLetters) { words.Add(new Word(g)); } return(words); }
public String runClustering(int clustersNumber, int botTHSales, int clusteringMethod) { String line = "INFORME CLUSTERIZACIÓN POR K-MEANS\n\n"; loadDataClustering(botTHSales); clustering = new Clustering(listClients, clustersNumber, clusteringMethod); clusters = clustering.clusters; for (int i = 0; i < clusters.Length; i++) { line += "CLUSTER " + i + ":\n#Elementos: " + clusters[i].itemsCluster.Count() + "\nClientes Pertenecientes:\n"; foreach (Client actual in clusters[i].itemsCluster) { line += actual.CardCode + "\n"; } line += "Compras Representativas del Cluster (Centroide):\n"; for (int j = 0; j < clusters[i].centroid.Count(); j++) { if (clusters[i].centroid[j] != 0) { line += listItems.ElementAt(j).itemName + "\n"; } } line += "\n"; } return(line); }
public String[] runClusteringSEP(int clustersNumber, int botTHSales, int clusteringMethod) { String[] resultado = new string[2]; loadDataClustering(botTHSales); clustering = new Clustering(listClients, clustersNumber, clusteringMethod); clusters = clustering.clusters; for (int i = 0; i < clusters.Length; i++) { resultado[0] += "CLUSTER " + i + ":$#Elementos: " + clusters[i].itemsCluster.Count() + "$Clientes Pertenecientes:$$"; foreach (Client actual in clusters[i].itemsCluster) { resultado[0] += "- " + actual.CardCode + "$"; } resultado[0] += "$"; resultado[1] += "COMPRAS REPRESENTATIVAS DEL CLUSTER #" + i + " (Centroide):$$"; for (int j = 0; j < clusters[i].centroid.Count(); j++) { if (clusters[i].centroid[j] != 0) { resultado[1] += "- " + listItems.ElementAt(j).itemName + "$"; } } resultado[1] += "$"; //line += "\n"; } return(resultado); }
/// <summary> /// Checks for changes between two clusterings /// </summary> /// <param name="oldClustering">A clustering which should be compared to</param> /// <returns>True, if clustering has changed. False, if clustering has not changed.</returns> public bool CheckForNewClustering(Clustering oldClustering, Clustering newClustering) { bool localResult = false; // false = no reclustering needed if (newClustering.NumberOfClusters != oldClustering.NumberOfClusters) { localResult = true; } else { for (int i = 0; i < newClustering.NumberOfClusters; i++) { if (!newClustering.Clusters[i].VolumeMask.Equals(oldClustering.Clusters[i].VolumeMask)) { localResult = true; } } } bool globalResult; unsafe { int localResultAsInt = localResult ? 1 : 0; int globalResultAsInt; csMPI.Raw.Allreduce((IntPtr)(&localResultAsInt), (IntPtr)(&globalResultAsInt), 1, csMPI.Raw._DATATYPE.INT, csMPI.Raw._OP.LOR, csMPI.Raw._COMM.WORLD); globalResult = globalResultAsInt == 1 ? true : false; } return(globalResult); }
public void Loaded(ViewLoadedParams p) { Clustering a = new Clustering(); // Save a reference to your loaded parameters. // You'll need these later when you want to use // the supplied workspaces sampleMenuItem = new MenuItem { Header = "Seurat Extension" }; sampleMenuItem.Click += (sender, args) => { var dynViewModel = p.DynamoWindow.DataContext as DynamoViewModel; var viewModel = new SeuratExtensionWindowViewModel(p, dynViewModel); var window = new SeuratExtensionWindow { // Set the data context for the main grid in the window. MainGrid = { DataContext = viewModel }, // Set the owner of the window to the Dynamo window. Owner = p.DynamoWindow }; window.Left = window.Owner.Left + 400; window.Top = window.Owner.Top + 200; // Show a modeless window. window.Show(); }; p.AddMenuItem(MenuBarType.View, sampleMenuItem); }
public static float[][,] GetBiomesFromClustering(IMap map, MapGen mapGen, int numCats) { Clustering km = new Clustering(); int[,] biomeClusters = km.ClusterMap(mapGen, numCats); float[][,] biomes = new float[numCats][, ]; for (int i = 0; i < numCats; i++) { biomes[i] = new float[map.xDim, map.yDim];; } for (int x = 0; x < map.xDim; x++) { for (int y = 0; y < map.yDim; y++) { bool isAboveSeaLevel = mapGen.Elevation[x, y] > mapGen.seaLevel; if (isAboveSeaLevel) { int ibiomeHere = biomeClusters[x, y]; biomes[ibiomeHere][x, y] = 1f; } } } return(biomes); }
private void btnTest_Click(object sender, EventArgs e) { //var thres = (int)nudThres.Value; //Image<Gray, byte> imgoutput = new Image<Gray, byte>(WorkingImg.Data); //for (int i = 0; i < 20; i++) //{ // int thr = 190 + i; // imgoutput = WorkingImg.ThresholdBinary(new Gray(thr), new Gray(255)); // imgoutput.Save(@"C:\Veeco_TestImg\Result" + "\\" + thr.ToString() + ".png"); //} //rtxLog.AppendText( "ThresInv_Click " + thres.ToString() + Environment.NewLine ); //RegistHisroty( WorkingImg ); var cluster = new Clustering(); var resultlist = cluster.test(WorkingImg.ToBitmap()); Image <Gray, byte> tetimg = new Image <Gray, byte>(resultlist["image"]); tetimg.Save(basepath + "Clustered.bmp"); label1.Text = ((int)resultlist["center"][0][0]).ToString(); label2.Text = ((int)resultlist["center"][1][0]).ToString(); label3.Text = ((int)resultlist["center"][2][0]).ToString(); WorkingImg = tetimg; RegistHisroty(WorkingImg); }
public void CreateProcFun(ThresholdMode mode) { double thres = PData.ThresholdV; double areaup = PData.UPAreaLimit; double areadw = PData.DWAreaLimit; double cHnum = PData.ChipHNum; double cWnum = PData.ChipWNum; Register_ProcMethod(); Clustering cluster = new Clustering(); ClusterImg = cluster.Segment(ClustMethod.KMean); ClusterData = cluster.DataClustering(ClustMethod.KMean); Sortcontours = FnSortcontours(); DoThreshold = FnThreshold(mode); ErodeRect = FnMorp(morpOp.Erode, kernal.Rect); DilateRect = FnMorp(morpOp.Dilate, kernal.Rect); ErodeVerti = FnMorp(morpOp.Erode, kernal.Vertical); DilateVerti = FnMorp(morpOp.Dilate, kernal.Vertical); ErodeHori = FnMorp(morpOp.Erode, kernal.Horizontal); DilateHori = FnMorp(morpOp.Dilate, kernal.Horizontal); CloseRect = FnMorp(morpOp.Close, kernal.Rect); OpenRect = FnMorp(morpOp.Open, kernal.Rect); TempMatch_Sq = FnTemplateMatch(TempMatchType.Sq); TempMatch_Ce = FnTemplateMatch(TempMatchType.Coeff); FindContour = FnFindContour(areaup, areadw); ApplyBox = FnApplyBox(PData.UPBoxLimit, PData.DWBoxLimit); SumAreaPoint = FnSumAreaPoint(( int )PData.ChipHSize, ( int )PData.ChipWSize, OriginImg); }
public static List <Cluster> Calculate(List <Point> points) { Point firstCenter = points[random.Next(points.Count)]; List <Cluster> clusters = new List <Cluster>() { new Cluster(firstCenter) }; bool isCompleted = false; do { Clustering.ClearClusters(clusters); Clustering.AddPointsToClusters(clusters, points); Point?newCenter = GetNewCenter(clusters); if (newCenter != null) { clusters.Add(new Cluster((Point)newCenter)); } else { isCompleted = true; } }while (!isCompleted); return(clusters); }
private static void TestFeedItems(FeedService feedService) { List <Feed> feeds = feedService.GetFeeds(); List <BagOfWords> bags = new List <BagOfWords>(); foreach (Feed feed in feeds) { bags.AddRange(feedService.AnalyzeFeedItems(feed)); } Clustering clustering = new Clustering(); double[,] similars = new double[bags.Count, bags.Count]; var docSimilars = new Dictionary <Tuple <BagOfWords, BagOfWords>, double>(); for (int i = 0; i < bags.Count - 1; i++) { for (int j = i + 1; j < bags.Count; j++) { if (bags[i].Type == bags[j].Type) { continue; } double sim = clustering.GetCosineDistance(bags[i], bags[j], true); similars[i, j] = sim; docSimilars.Add(new Tuple <BagOfWords, BagOfWords>(bags[i], bags[j]), sim); } } Console.In.ReadLine(); OutputSimilarityMatrix(docSimilars); }
/// <summary> /// Get the <see cref="TextBlock"/>s. /// <para>This is the Docstrum algorithm's 3rd and final step.</para> /// <para> /// Method: We want to measure the distance between two lines using the following method: /// <br>- We check if two lines are overlapping horizontally and compute the perpendicular distance.</br> /// <br>- We check if the angle between the two line is within 'angularDifference'.</br> /// <br>- If the two lines are not overlapping or the angle is too wide, the distance is set to the infinity.</br> /// <para>If two text lines are approximately parallel, close in perpendicular distance, and they either overlap to some specified degree or are separated by only a small distance in parallel distance, then they are said to meet the criteria to belong to the same structural block.</para> /// </para> /// </summary> /// <param name="lines">The lines to segment into <see cref="TextBlock"/>s.</param> /// <param name="maxBLDistance">The maximum between-line distance. Computed as the estimated between-line spacing times the between-line multiplier in the default implementation.</param> /// <param name="angularDifferenceBounds">The angular difference bounds between two lines to be considered in the same block. This defines if two lines are parallel enough.</param> /// <param name="epsilon">Precision when testing equalities.</param> /// <param name="lineSeparator">Separator used between lines when building paragraphs.</param> /// <param name="maxDegreeOfParallelism">Sets the maximum number of concurrent tasks enabled. /// <para>A positive property value limits the number of concurrent operations to the set value. /// If it is -1, there is no limit on the number of concurrently running operations.</para></param> /// <returns>The <see cref="TextBlock"/>s built.</returns> public static IEnumerable <TextBlock> GetStructuralBlocks(IReadOnlyList <TextLine> lines, double maxBLDistance, AngleBounds angularDifferenceBounds, double epsilon, string lineSeparator, int maxDegreeOfParallelism) { /****************************************************************************************************** * We want to measure the distance between two lines using the following method: * We check if two lines are overlapping horizontally and compute the perpendicular distance. * We check if the angle between the two line is within 'angularDifference'. * If the two lines are not overlapping or the angle is too wide, the distance is set to the infinity. * * If two text lines are approximately parallel, close in perpendicular distance, and they either * overlap to some specified degree or are separated by only a small distance in parallel distance, * then they are said to meet the criteria to belong to the same structural block. ******************************************************************************************************/ var groupedLines = Clustering.NearestNeighbours( lines, (l1, l2) => PerpendicularOverlappingDistance(l1, l2, angularDifferenceBounds, epsilon), (_, __) => maxBLDistance, pivot => new PdfLine(pivot.BoundingBox.BottomLeft, pivot.BoundingBox.BottomRight), candidate => new PdfLine(candidate.BoundingBox.TopLeft, candidate.BoundingBox.TopRight), _ => true, (_, __) => true, maxDegreeOfParallelism).ToList(); foreach (var g in groupedLines) { yield return(new TextBlock(g.OrderByReadingOrder(), lineSeparator)); } }
/// <summary> /// Gets the words. /// </summary> /// <param name="pageLetters">The letters in the page.</param> /// <param name="maxDistanceFunction">The function that determines the maximum distance between two letters (start and end base line points), /// e.g. Max(GlyphRectangle.Width) x 20%. /// <para>If the distance between the two letters is greater, a new word will be created.</para></param> /// <param name="distMeasure">The distance measure between two letters (start and end base line points), /// e.g. the Manhattan distance.</param> /// <param name="filterFunction">Function used to filter out connection between letters, e.g. check if the letters have the same color. /// <para>If the function returns false, a new word will be created.</para></param> /// <param name="maxDegreeOfParallelism">Sets the maximum number of concurrent tasks enabled. /// <para>A positive property value limits the number of concurrent operations to the set value. /// If it is -1, there is no limit on the number of concurrently running operations.</para></param> public List <Word> GetWords(IReadOnlyList <Letter> pageLetters, Func <Letter, Letter, double> maxDistanceFunction, Func <PdfPoint, PdfPoint, double> distMeasure, Func <Letter, Letter, bool> filterFunction, int maxDegreeOfParallelism) { if (pageLetters == null || pageLetters.Count == 0) { return(new List <Word>()); } var groupedIndexes = Clustering.NearestNeighbours(pageLetters, distMeasure, maxDistanceFunction, l => l.EndBaseLine, l => l.StartBaseLine, l => !string.IsNullOrWhiteSpace(l.Value), filterFunction, maxDegreeOfParallelism).ToList(); List <Word> words = new List <Word>(); for (int a = 0; a < groupedIndexes.Count; a++) { words.Add(new Word(groupedIndexes[a].Select(i => pageLetters[i]).ToList())); } return(words); }
private static void dbSQLite() { // Connect to the database var path = Path.GetFullPath("./database.sqlite"); var db = new SqliteDb(path); db.Connect(); // Populate a list of iris from the database List <Iris> listPredict = new List <Iris>(); db.Command <Iris>("SELECT * FROM Iris", (iris) => { listPredict.Add(iris); }); // Perform the clustering data mining operation based on attribute(s) var clusterer = new Clustering <Iris>(5, listPredict); clusterer.BuildModel("SepalLengthCm"); // For each item, predict and output which cluster it's in foreach (var item in listPredict) { // Each item is tested against the test data set var result = clusterer.Evaluate(item); Console.WriteLine(result.SelectedClusterId); Console.WriteLine(string.Join(" ", result.Distance)); } }
public void ClusteringReevaluated(Clustering cluster) { if (cluster.Level == nlevels - 1) { FireReevalutadeHandler(); } }
private (double[], List <int>) GetPerCluster_dtMin_SubSteps(Clustering clustering, IList <TimeStepConstraint> timeStepConstraints, double eps) { // Get smallest time step size of every cluster --> loop over all clusters // Currently: CFLFraction is not taken into account double[] sendDtMin = new double[clustering.NumberOfClusters]; double[] rcvDtMin = new double[clustering.NumberOfClusters]; MultidimensionalArray cellMetric = GetStableTimestepSize(clustering.SubGrid, timeStepConstraints); for (int i = 0; i < clustering.NumberOfClusters; i++) { double dtMin = double.MaxValue; CellMask volumeMask = clustering.Clusters[i].VolumeMask; foreach (Chunk c in volumeMask) { int JE = c.JE; for (int j = c.i0; j < JE; j++) { dtMin = Math.Min(cellMetric[clustering.SubGrid.LocalCellIndex2SubgridIndex[j]], dtMin); } } sendDtMin[i] = dtMin; } // MPI Allreduce necessary to exchange the smallest time step size of each cluster on each processor unsafe { fixed(double *pSend = sendDtMin, pRcv = rcvDtMin) { csMPI.Raw.Allreduce((IntPtr)(pSend), (IntPtr)(pRcv), clustering.NumberOfClusters, csMPI.Raw._DATATYPE.DOUBLE, csMPI.Raw._OP.MIN, csMPI.Raw._COMM.WORLD); } } // Take CFLFraction into account for testing //for (int i = 0; i < rcvHmin.Length; i++) { // rcvHmin[i] *= 0.3; //} List <int> subSteps = CalculateSubSteps(rcvDtMin, eps); if (subSteps.Last() > this.MaxSubSteps && this.Restrict) { //#if DEBUG List <int> oldSubSteps = subSteps; double[] oldRcvDtMin = rcvDtMin; //#endif (rcvDtMin, subSteps) = RestrictDtsAndSubSteps(rcvDtMin, subSteps); if (consoleOutput) { Console.WriteLine("### RESTRICTION OF SUB-STEPS ### (dt min)"); for (int i = 0; i < subSteps.Count; i++) { Console.WriteLine("RestrictDtsAndSubSteps:\t id={0} -> sub-steps={1}\tdt={2:0.#######E-00} -> substeps={3}\tdt={4:0.#######E-00}", i, oldSubSteps[i], oldRcvDtMin[i], subSteps[i], rcvDtMin[i]); } } } return(rcvDtMin, subSteps); }
public void CurrentClusteringLayerLevel_Set(int layer) { Clustering newclustering = ClusteringLayerLevel_Get(layer); if (newclustering != null) { CurrentLevel.Set(newclustering); } }
// Update is called once per frame void Update() { if (pointerActivated && LabelingEnabled) { if (OVRInput.Get(OVRInput.Button.PrimaryThumbstick)) { if (pointerSelectionActivated) { var collidedObject = GetPointerCollisionObject(); if (!collidedObject) { return; } //Clustering if (collidedObject.GetComponent <CustomAttributes>()._label != Labeling.currentLabelClassID && ClusterLabelingEnabled) { List <GameObject> clusteredObjects = Clustering.GetClusterByRadiusSearch(collidedObject, 5.5f, false); for (int i = 0; i < clusteredObjects.Count; i++) { if (clusteredObjects[i].GetComponent <CustomAttributes>()._label != Labeling.currentLabelClassID) { clusteredObjects[i].GetComponent <CustomAttributes>()._label = Labeling.currentLabelClassID; } } } } } else { if (pointerSelectionActivated) { var collidedObject = GetPointerCollisionObject(); if (!collidedObject) { return; } var collider = Physics.OverlapSphere(collidedObject.transform.position, collidedObject.GetComponent <SphereCollider>().radius *collidedObject.transform.localScale.x); for (int i = 0; i < collider.Length; i++) { var attr = collider[i].gameObject.GetComponent <CustomAttributes>(); if (attr) { if (attr._label != Labeling.currentLabelClassID) { attr._label = Labeling.currentLabelClassID; } } } } } } }
public List <Clustering> GetClusteringLayers() { List <Clustering> lst = new List <Clustering>(); for (Clustering c = level0; c != null; c = c.Above) { lst.Add(c); } return(lst); }
} // levelTop; } public Clustering GetClusteringLayer(int level) { Clustering c = level0; while (c.Level < level) { c = c.Above; } return(c); }
public void AddClusters(Clustering clustering) { foreach (var cluster in clustering.DataClusters) { var dataset = new Dataset(cluster.Value); var name = $"Cluster {cluster.Key}"; var series = new DataSeries(Highchart.Scatterplot, dataset, name); _chart.AddDataSeries(series); } }
/// <summary> /// Computes the Bag of Words model. /// </summary> /// /// <param name="features">The extracted image features to initialize the model.</param> /// /// <returns>The list of feature points detected in all images.</returns> /// public void Compute(TFeature[] features) { if (features.Length <= NumberOfWords) { throw new InvalidOperationException("Not enough data points to cluster. Please try " + "to adjust the feature extraction algorithm to generate more points."); } // Compute the descriptors clusters Clustering.Compute(features); }
public (double[], List <int>) GetPerCluster_dtHarmonicSum_SubSteps(Clustering clustering, double time, IList <TimeStepConstraint> timeStepConstraints, double eps) { double[] clusterDts = new double[clustering.NumberOfClusters]; for (int i = 0; i < clustering.NumberOfClusters; i++) { // Use "harmonic sum" of step - sizes, see // WatkinsAsthanaJameson2016 for the reasoning double dt = 1.0 / timeStepConstraints.Sum( c => 1.0 / c.GetGloballyAdmissibleStepSize(clustering.Clusters[i])); if (dt == 0.0) { throw new ArgumentException( "Time-step size is exactly zero."); } else if (double.IsNaN(dt)) { throw new ArgumentException( "Could not determine stable time-step size in sub-grid " + i + ". This indicates illegal values in some cells."); } // Restrict timesteps dt = Math.Min(dt, timeStepConstraints.First().Endtime - time); dt = Math.Min(Math.Max(dt, timeStepConstraints.First().dtMin), timeStepConstraints.First().dtMax); clusterDts[i] = dt; } List <int> subSteps = CalculateSubSteps(clusterDts, eps); for (int i = 0; i < clusterDts.Length; i++) { clusterDts[i] = clusterDts[0] / subSteps[i]; } if (subSteps.Last() > this.MaxSubSteps && this.Restrict) { //#if DEBUG List <int> oldSubSteps = subSteps; double[] oldClusterDts = clusterDts; //#endif (clusterDts, subSteps) = RestrictDtsAndSubSteps(clusterDts, subSteps); if (consoleOutput) { Console.WriteLine("### RESTRICTION OF SUB-STEPS ### (dt min)"); for (int i = 0; i < subSteps.Count; i++) { Console.WriteLine("RestrictDtsAndSubSteps:\t id={0} -> sub-steps={1}\tdt={2:0.#######E-00} -> substeps={3}\tdt={4:0.#######E-00}", i, oldSubSteps[i], oldClusterDts[i], subSteps[i], clusterDts[i]); } } } return(clusterDts, subSteps); }
public List <TFeature>[] Compute(Bitmap[] images, double threshold) { // Hack to maintain backwards compatibility var prop = Clustering.GetType().GetProperty("Tolerance"); if (prop != null && prop.CanWrite) { prop.SetValue(Clustering, threshold, null); } return(Compute(images)); }
/////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /// <summary> /// Constructor. /// </summary> public MapControl() { InitializeComponent(); MapLayersWidget.ActiveBaseLayerChanged += new RoutedEventHandler(MapLayersWidget_ActiveBaseLayerChanged); _mapTips = new MapTips(); _tools = new MapTools(this, toolPanel); _clustering = new Clustering(this); _mapSelectionManager = new MapSelectionManager(this, _clustering, _objectLayers); _mapEventsManager = new MapEventsManager(this, _mapSelectionManager, _clustering, _tools, _mapTips); _mapExtentManager = new MapExtentManager(this, _clustering, _mapSelectionManager); }
public Clustering RemoveLevel(int ilevel) { if (ilevel == 0) { throw new ArgumentException("Cannot remove Level0 Clustering Layer"); } Clustering removed = GetClusteringLayer(ilevel); removed.Reevaluated -= ClusteringReevaluated; removed.Remove(); nlevels--; FireReevalutadeHandler(); return(removed); }
public ActionResult Index() { int testProjectId = Convert.ToInt32(resource.GetString("testProjectId")); List <ProjectModel> projectList = getProjectsList(resource.GetString("testProjectToken"), resource.GetString("testProjectUser")); InputDataConverter inputDataConverter = new InputDataConverter(); var projectSelected = from project in projectList where project.id == testProjectId select project; ProjectModel projectWithTestData = projectSelected.ToList()[0]; clustering = new Clustering(inputDataConverter.convertListToClusterObject(projectWithTestData.issuesList), 9); clustering.initializationClusterCenters(); clustering.clustering(); return(View()); }
/// <summary> /// Handles the ClusteringCompleted event /// </summary> /// <param name="args">The arguments for the event</param> public void ClusteringCompletedEventHandler(Clustering.ClusteringCompletedEventArgs args) { // Layout the graph LayoutGraph(LayoutManager.Instance.DefaultLayout, false); }