我在尝试向数据库中插入行时遇到一些问题,尽管直到现在我添加了“ key”列,但它仍然无法工作并给我一个错误。 >
use Session;
错误:
use Session;
任何帮助都是伟大的! (所有这些输入都是字符串,并且“键”也指定为“现代”)
答案 0 :(得分:1)
public class IrisData
{
public float Label;
public float SepalLength;
public float SepalWidth;
public float PetalLength;
public float PetalWidth;
}
public class IrisVectorData
{
public float Label;
public float[] Features;
}
static void Main(string[] args)
{
// Here's a data array that we want to work on.
var dataArray = new[] {
new IrisData{Label=1, PetalLength=1, SepalLength=1, PetalWidth=1, SepalWidth=1},
new IrisData{Label=0, PetalLength=2, SepalLength=2, PetalWidth=2, SepalWidth=2}
};
// Create the ML.NET environment.
var env = new Microsoft.ML.Runtime.Data.TlcEnvironment();
// Create the data view.
// This method will use the definition of IrisData to understand what columns there are in the
// data view.
var dv = env.CreateDataView<IrisData>(dataArray);
// Now let's do something to the data view. For example, concatenate all four non-label columns
// into 'Features' column.
dv = new Microsoft.ML.Runtime.Data.ConcatTransform(env, dv, "Features",
"SepalLength", "SepalWidth", "PetalLength", "PetalWidth");
// Read the data into an another array, this time we read the 'Features' and 'Label' columns
// of the data, and ignore the rest.
// This method will use the definition of IrisVectorData to understand which columns and of which types
// are expected to be present in the input data.
var arr = dv.AsEnumerable<IrisVectorData>(env, reuseRowObject: false)
.ToArray();
}
是MySQL中的reserved word。当用作标识符时,必须在查询中引用它:
KEY