本文整理汇总了C#中API.GetDefaultClustersCenters方法的典型用法代码示例。如果您正苦于以下问题:C# API.GetDefaultClustersCenters方法的具体用法?C# API.GetDefaultClustersCenters怎么用?C# API.GetDefaultClustersCenters使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类API
的用法示例。
在下文中一共展示了API.GetDefaultClustersCenters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
//https://msdn.microsoft.com/en-us/library/windows/apps/ff402526(v=vs.105).aspx
static void Main(string[] args)
{
API client = new API();
var data = client.LoadFile("mainText.txt");
//var multiData = client.LoadFilesMulticore(new List<string>() { "mainText.txt", "mainTextShort.txt", "prepositions.txt", "unions.txt" });
var mst_one = client.HandleByMystem(data);
//var mst_several = client.HandleByMystemMulticore(multiData);
var stats_words_one = client.ProvideWordsStatsAnalysis(mst_one);
var dict = client.GetDataReady<string>(stats_words_one);
var cl_centers = client.GetDefaultClustersCenters(dict);
var cl_settings = new ClasterSettings<string>(cl_centers, 0.000000000000000000000000001, 1.5f, 10000, dict);
var result = client.ProvideClusterAnalysis<string>(cl_settings, "1");
string json = JsonConvert.SerializeObject(result.Result.Select(i => new { name = i.Key, values = i.Value }));
//ClasterAnalysis<string> ca = new ClasterAnalysis<string>(d, 0.000000000000000000000000001, 1.5f, 10000, clusters);
//var res = ca.Clusterize();
//var stats_digrams_one = client.ProvideDigramsStatsAnalysis(mst_one);
//var stats_words_several = client.ProvideWordsStatsAnalysisMulticore(mst_several);
//var stats_digrams_several = client.ProvideDigramsStatsAnalysisMulticore(mst_several);
Console.WriteLine("That's all!");
/*Multiprocessor mps = new Multiprocessor();
mps.MultiprocessorFileRead(new List<string>() { "mainText.txt" });
var texts = mps.Cache;
MystemProvider mst = new MystemProvider(1);
var list = mst.LaunchMystem(texts[0].List);
var words = list.Select(el =>
{
if (el.analysis.Length == 0)
return el.text;
return el.analysis[0].lex;
}).ToList();
var frequencyWordDict = StatisticsAnalysis.GetFrequencyDictionary(words);
var frequencyDigramDict = StatisticsAnalysis.GetDigramFrequenceDictionary(words);
var mutualInf = StatisticsAnalysis.CalculateMutualInformation(frequencyDigramDict, frequencyWordDict, words.Count);
var tScore = StatisticsAnalysis.CalculateTScore(frequencyDigramDict, frequencyWordDict, words.Count);
var llh = StatisticsAnalysis.CalculateLogLikelihood(frequencyDigramDict);
List<Dictionary<WordDigram, double>> dList = new List<Dictionary<WordDigram, double>>();
dList.Add(frequencyDigramDict.ToDictionary(i => i.Key, i => (double)i.Value));
//dList.Add(mutualInf);
//dList.Add(tScore);
//dList.Add(llh);
var mergedDictionary = dList.MergeDictionaries<WordDigram>();
//СЛОВА
List<Dictionary<string, double>> wlist = new List<Dictionary<string, double>>();
wlist.Add(frequencyWordDict.ToDictionary(i => i.Key, i => (double)i.Value));
var d = wlist.MergeDictionaries<string>();
var m = d.Select(i => new { i.Key, v = i.Value[0] }).ToList();
var c = m.OrderByDescending(i => i.v).ToList();
double[,] clusters = new double[,]
{
//{ 14.8f, 0.96f, 3.29 }
//{ 1, 10, 0.2f, 2 }
//{ 10, 0.1f, 1 }
{ 25 },
//{ 10 },
{ 5 }
};
ClasterAnalysis<string> ca = new ClasterAnalysis<string>(d, 0.000000000000000000000000001, 1.5f, 10000, clusters);
var res = ca.Clusterize();
var n = (
from i in c
join j in res on i.Key equals j.Key
select new { word = i.Key, values = j.Value, count = i.v }
).ToList();
//var r = res.Where(i => i.Key.FirstWord == "взаимодействие");*/
}