本文整理汇总了C#中DataManager.CreateAttributes方法的典型用法代码示例。如果您正苦于以下问题:C# DataManager.CreateAttributes方法的具体用法?C# DataManager.CreateAttributes怎么用?C# DataManager.CreateAttributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataManager
的用法示例。
在下文中一共展示了DataManager.CreateAttributes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoMyWindow
private void DoMyWindow(int windowID)
{
switch(pgState)
{
case programStates.StartWindow:
if(completeT)
{
drawTw = false;
locationT = tfsw.getLocation;
completeT = false;
}
if(completeC)
{
drawCw = false;
locationC = cfsw.getLocation;
completeC = false;
}
Rect groupRect = new Rect(windowRect.x + windowRect.width/2-20.0f, windowRect.y + windowRect.height/2 - 20.0f, windowRect.width/2+20.0f, 60.0f);
GUI.BeginGroup(groupRect);
locationT = GUI.TextArea(new Rect(-5.0f, 0.0f, groupRect.width - groupRect.width/7, 20.0f), locationT);
if(GUI.Button(new Rect(groupRect.width - groupRect.width/7 - 5.0f, 0.0f, groupRect.width/7, 20.0f), "Get test set"))
{
drawTw = true;
enabling = false;
}
locationC = GUI.TextArea(new Rect(-5.0f, 40.0f, groupRect.width - groupRect.width/7, 20.0f), locationC);
if(GUI.Button(new Rect(groupRect.width - groupRect.width/7 - 5.0f, 40.0f, groupRect.width/7, 20.0f), "Classifier set"))
{
drawCw = true;
enabling = false;
}
GUI.EndGroup();
GUI.Label(new Rect(groupRect.x + groupRect.width/2 - 10.0f, groupRect.y + groupRect.height + 20.0f, 20.0f, 20.0f), "K");
sK = k.ToString();
sK = GUI.TextField(new Rect(groupRect.x + groupRect.width/2 - 10.0f, groupRect.y + groupRect.height + 40.0f, 20.0f, 20.0f), sK, 1);
sK = Regex.Replace(sK, "[^a-zA-Z0-9 #[email protected]]", "0");
k = int.Parse(sK);
if(locationT != "")
{
if(k > 0 && new FileInfo(locationT).Extension == ".csv")
{
nextEnabled = true;
}
}
GUI.enabled = nextEnabled;
if(GUI.Button(new Rect(windowRect.width - windowRect.width/8, windowRect.height - 20.0f, groupRect.width/8, 20.0f), "Next"))
{
tdh = new Datahandler(locationT);
if(locationC != "" && (new FileInfo(locationC).Extension == ".csv"))
{
cdh = new Datahandler(locationC);
}
pgState = programStates.LoadSecond;
}
GUI.enabled = true;
break;
case programStates.LoadSecond:
tddv = new DrawDatasetValues(new Vector2(windowRect.x + windowRect.width - windowRect.width/2 - 205.0f, windowRect.y + windowRect.height - windowRect.height/2 - 150.0f), tdh.getDataTable);
drawTw = drawCw = completeT = completeC = nextEnabled = false;
pgState = programStates.SecondWindow;
break;
case programStates.SecondWindow:
tddv.Draw();
if(tddv.theX != "" && tddv.theY != "" && tddv.theClassifier != "")
{
nextEnabled = true;
}
GUI.enabled = nextEnabled;
if(GUI.Button(new Rect(windowRect.width - windowRect.width/8, windowRect.height - 20.0f, (windowRect.width/2)/8, 20.0f), "Next"))
{
pgState = programStates.LoadDraw;
}
GUI.enabled = true;
break;
case programStates.LoadDraw:
DataTable tTable = tdh.getDataTable;
DataManager tdm = new DataManager(tTable, tTable.Columns[tddv.theX], tTable.Columns[tddv.theY], tTable.Columns[tddv.theClassifier], Calculator.minmax(tTable, tTable.Columns[tddv.theX]), Calculator.minmax(tTable, tTable.Columns[tddv.theY]));
ClassifierColor.instantiate(tTable, tTable.Columns[tddv.theClassifier]);
Attributes[] tdmAtts, cdmAtts;
tdmAtts = tdm.CreateAttributes();
if(cdh != null)
{
DataManager cdm = new DataManager(cdh.getDataTable, tTable.Columns[tddv.theX], tTable.Columns[tddv.theY], Calculator.minmax(tTable, tTable.Columns[tddv.theX]), Calculator.minmax(tTable, tTable.Columns[tddv.theY]));
cdmAtts = cdm.CreateAttributes();
foreach(Attributes cAtt in cdmAtts)
{
SpecialK Knearest = new SpecialK(tdmAtts, cAtt, k);
cAtt.importK(Knearest.eucli, Knearest.cheby, Knearest.manhatt, true);
}
cAtts = cdmAtts;
}
//.........这里部分代码省略.........