本文整理汇总了C#中Table.set方法的典型用法代码示例。如果您正苦于以下问题:C# Table.set方法的具体用法?C# Table.set怎么用?C# Table.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Table
的用法示例。
在下文中一共展示了Table.set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TableDrivenAgentProgram
// persistent: percepts, a sequence, initially empty
// table, a table of actions, indexed by percept sequences, initially fully
// specified
/**
* Constructs a TableDrivenAgentProgram with a table of actions, indexed by
* percept sequences.
*
* @param perceptSequenceActions
* a table of actions, indexed by percept sequences
*/
public TableDrivenAgentProgram(Dictionary<List<Percept>, Action> perceptSequenceActions)
{
List<List<Percept>> rowHeaders = new List<List<Percept>>(perceptSequenceActions.Keys);
List<System.String> colHeaders = new List<System.String>();
colHeaders.Add(ACTION);
table = new Table<List<Percept>, System.String, Action>(rowHeaders, colHeaders);
foreach (List<Percept> row in rowHeaders)
{
table.set(row, ACTION, perceptSequenceActions[row]);
}
}
示例2: TableBasicTest
public void TableBasicTest()
{
Table table = new Table(TEST_DATA_1, true);
// 测试读取数据
Assert.AreEqual(3, table.Headers.Count);
Assert.AreEqual("BEGIN", table.Headers[0]);
Assert.AreEqual("END", table.Headers[1]);
Assert.AreEqual("DELAY", table.Headers[2]);
Dictionary<string,string> dict = table.getDictionary(0);
Assert.AreEqual(".1", dict["BEGIN"]);
// 测试更新数据
table.Data[0][0] = ".100";
table.set("END", 0, ".200");
Dictionary<string, string> dict2 = table.getDictionary(0);
Assert.AreEqual(".100", dict2["BEGIN"]);
Assert.AreEqual(".200", dict2["END"]);
string actural = table.serialize();
Assert.AreNotEqual(TEST_DATA_1.Replace("\r", ""), actural);
}
示例3: createTargetValueLearnerTable
private Table<String, Learner, Double> createTargetValueLearnerTable(
List<String> targetValues, Example e) {
// create a table with target-attribute values as rows and learners as
// columns and cells containing the weighted votes of each Learner for a
// target value
// Learner1 Learner2 Laerner3 .......
// Yes 0.83 0.5 0
// No 0 0 0.6
Table<String, Learner, Double> table = new Table<String, Learner, Double>(
targetValues, learners);
// initialize table
foreach (Learner l in learners) {
foreach (String s in targetValues) {
table.set(s, l, 0.0);
}
}
foreach (Learner learner in learners) {
String predictedValue = learner.predict(e);
foreach (String v in targetValues) {
if (predictedValue.Equals(v)) {
table.set(v, learner, table.get(v, learner)
+ learnerWeights[learner] * 1);
}
}
}
return table;
}