Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/11/19 16:30:22 (5 years ago)
Author:
msemenki
Message:

#2988:

  1. The file system was changed, folders was added and part of files was transferred in these folders.
  2. HelpFunctions class was divided on 2 parts: HelpFuctions for common purposes static functions and SelfConfiguration that include functions for self-configuration mechanism realization (is used in EMMSucsessMap).
  3. Parts of self-configuration mechanism was transferred from EMMSucsessMap.cs to SelfConfiguration.cs. Now EMMSucsessMap used SelfConfiguration like one of data member. Other parts of project was adopted for this changing.
  4. FileComunication class was added. It include the majority of functions for printing to files or reading from files. Here were realized possibility to write and read to hl files.
  5. ModelTreeNode.cs has additional possibility - to write sub-model in string (then it is possible to write it in file).
  6. InfixExpressionFormatter.cs can work with TreeModelNode.
  7. Possibility for different map types to be readable from files was extended and cheeked.
  8. Such parameters like - ClusterNumbers, ClusterNumbersShow, NegbourNumber, NegbourType (that is used only in several maps) was transferred from EMMAlgorithm to Map Parameters. Now EMMBaseMap class inherited from ParameterizedNamedItem (not from Item). And EMMIslandMap and EMMNetworkMap contains their parameters (constructors was modified). CreationMap calls functions were simplified.
  9. Functions for different distance metric calculation was added. Now, it is possible to calculate different types of distances between models (with different random values of constants).
  10. DistanceParametr was added. Now maps can be created according different types of distance calculations.
  11. The class EMMClustering has new name KMeansClusterizationAlgorithm. On KMeansClusterizationAlgorithm bug with bloating of centroids list was fixed. Algorithm was adopted for working with different type of distance metric and get maximum number of iterations.
  12. Possibilities for constants optimization in sub-models an whole tree was added. EMMAlgorithm get new function for evaluation of individuals (and some additional technical stuff for that). Function for trees with model in usual tree transformation and back was added.
  13. EMMAlgorithm was divided on 2 parts:
  • EMMAlgorithm, that contain evolutionary algorithm working with sub-models, and use ready to use maps;
  • ModelSetPreparation, that contain distance calculation, model set simplification and map creation.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • branches/2988_ModelsOfModels2/HeuristicLab.Algorithms.EMM/KMeansClusterizationAlgorithm.cs

    r17133 r17134  
    2121
    2222using HeuristicLab.Core;
     23using System;
    2324using System.Collections.Generic;
    2425
    2526namespace HeuristicLab.Algorithms.EvolvmentModelsOfModels {
    26   public class EMModelsClusterizationAlgorithm {
     27  public class KMeansClusterizationAlgorithm {
    2728    public int K { get; private set; }
    28     public EMModelsClusterizationAlgorithm() {
     29    public KMeansClusterizationAlgorithm() {
    2930    }
    30     public EMModelsClusterizationAlgorithm(int k) {
     31    public KMeansClusterizationAlgorithm(int k) {
    3132      K = k;
    3233    }
    33     public EMModelsClusterizationAlgorithm(EMModelsClusterizationAlgorithm old) {
     34    public KMeansClusterizationAlgorithm(KMeansClusterizationAlgorithm old) {
    3435      this.K = old.K;
    3536    }
     
    5253      }
    5354      bool flag = true;
    54 
    55       while (flag) {
     55      int count = 0;
     56      while (flag&&(count<1000)) {
    5657        clusters.Clear();
    5758        for (int i = 0; i < k; i++) {
     
    6162        for (int i = 0; i < mapSize; i++) {
    6263          numberCluster[i] = LookCloseCentroid(centroids, distances, i, k);
    63           clusters[numberCluster[i]].Add(numberCluster[i]);
     64          clusters[numberCluster[i]].Add(i);
    6465        }
    6566        k = NullSizeClusterDelete(centroids, clusters, mapSize, numberCluster, k);
     
    7475          averageClusterDistance.Clear();
    7576        }
     77        count++;
    7678      }
    7779      return k;
     
    110112          }
    111113          clusters.Remove(clusters[i - iter]);
    112           centroids.Remove(i - iter);
     114          centroids.Remove(centroids[i - iter]);
    113115          iter++;
    114116        }
     
    117119      return k;
    118120    }
    119     private static void AverageClusterDistanceCalculation(List<double> averageClusterDistance, double[,] distances, List<int> numberCluster, int MapSize, int currentClusterNumber) {
     121    public static void AverageClusterDistanceCalculation(List<double> averageClusterDistance, double[,] distances, List<int> numberCluster, int MapSize, int currentClusterNumber) {
    120122      int m = 0;
    121123      for (int i = 0; i < MapSize; i++) {
     
    124126          for (int j = 0; j < MapSize; j++) {
    125127            if (numberCluster[j] == currentClusterNumber)
    126               averageClusterDistance[m] += distances[i, j];
     128              averageClusterDistance[m] += Math.Abs(distances[i, j]);
    127129          }
    128130          m++;
Note: See TracChangeset for help on using the changeset viewer.