我可以KMeans
很容易地计算集群成员资格:
open System
open System.IO
open Utils
open Accord
open Accord.Math
open Accord.MachineLearning
let vals = [|
[|1.0; 2.0; 3.0; 2.0|]
[|1.1; 1.9; 3.1; 4.0|]
[|2.0; 3.0; 4.0; 4.0|]
[|3.0; 3.1; 2.0; 3.0|]
[|2.0; 4.0; 3.0; 6.0|]
[|1.0; 5.0; 5.0; 7.0|]
[|4.0; 3.0; 6.0; 8.0|]
[|5.0; 4.0; 3.0; 6.0|]
[|6.0; 4.0; 8.0; 7.0|]
[|5.0; 6.0; 5.0; 9.0|]
[|4.0; 2.0; 7.0; 8.0|]
[|8.0; 9.0; 3.1; 2.2|]
[|8.0; 9.0; 2.0; 2.0|]
[|10.0; 2.0; 3.0; 2.0|]
[|10.1; 1.9; 3.1; 4.0|]
[|20.0; …
Run Code Online (Sandbox Code Playgroud) <?xml version="1.0"?>
<ArrayOfSequence xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Sequence>
<SourcePath>
<Point>
<X>261</X>
<Y>210</Y>
</Point>
<Point>
<X>261</X>
<Y>214</Y>
</Point>
<Point>
<X>261</X>
<Y>227</Y>
</Point>
<Point>
<X>261</X>
<Y>229</Y>
</Point>
<Point>
<X>261</X>
<Y>231</Y>
</Point>
<Point>
<X>261</X>
<Y>234</Y>
</Point>
<Point>
<X>261</X>
<Y>237</Y>
</Point>
</Sequence>
</ArrayOfSequence>
Run Code Online (Sandbox Code Playgroud)
我正在使用accord.net鼠标手势识别示例应用程序,它以上面的xml格式保存文件.我需要帮助将上面的xml转换为CSV格式,这样我就可以使用accord.net动态时间扭曲进行机器学习.我无法弄清楚如何转换为csv文件.例如:261,210,261,214,261,229,261,231
我是新手机器学习和新手accord.net
(我编码C#).
我想创建一个简单的项目,我在其中查看振荡的简单时间序列数据,然后我希望accord.net学习它并预测下一个值将是什么.
这就是数据(时间序列)应该是这样的:
X - Y.
1 - 1
2 - 2
3 - 3
4 - 2
5 - 1
6 - 2
7 - 3
8 - 2
9 - 1
Run Code Online (Sandbox Code Playgroud)
然后我希望它预测以下内容:
X - Y.
10 - 2
11 - 3
12 - 2
13 - 1
14 - 2
15 - 3
Run Code Online (Sandbox Code Playgroud)
你能帮我解决一些如何解决它的例子吗?
我正在使用Accord.Video.FFMPEG来录制屏幕.我面临的问题是CPU和内存利用率都过高.通常,我们的进程使用最大2%的CPU和30 MB的内存,但是当我们开始视频捕获时,CPU上升到17%,内存达到700MB.我试着把
所以GC.Collect();
但没有用.
private void video_NewFrame(object sender, NewFrameEventArgs eventArgs)
{
try
{
if (this._isRecording)
{
int screenRecordingLength = screenRecrodingRule != null ? screenRecrodingRule.length : 500;
//Bitmap frame;
Bitmap frame = eventArgs.Frame;
{
Graphics graphics = Graphics.FromImage(frame);
try
{
CURSORINFO pci;
pci.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(CURSORINFO));
if (GetCursorInfo(out pci))
{
if (pci.flags == CURSOR_SHOWING)
{
int x = pci.ptScreenPos.x - screenLeft;
int y = pci.ptScreenPos.y - screenTop;
Color c = Color.Yellow;
float width = 2;
int radius = 30;
if ((Control.MouseButtons & …
Run Code Online (Sandbox Code Playgroud) 我想使用accord.net框架从一组数据生成决策树.
我在这个链接中阅读了指南http://crsouza.blogspot.com/2012/01/decision-trees-in-c.html
我能够通过遵循它来生成树.但是如何使用它来预测新的输入?
我的意思是在创建树之后我想使用它(作为if-else语句来了解新输入的输出)
据说我可以将它转换为表达式, var expression = tree.ToExpression();
但我该如何使用它?
谢谢你的帮助
我开发了一个图像皮肤检测应用程序
但是我的相机存在问题,试图补偿光线并且结果图像很差,在大多数情况下,我对图像有冷或热效果.当我使用Photoshop时,有AutoTone功能可以规范化图像并减少此问题.
使用aforge我想使用HistogramEqualization()过滤器,但结果非常糟糕:
// create filter
HistogramEqualization filter = new HistogramEqualization( );
// process image
filter.ApplyInPlace( sourceImage );
Run Code Online (Sandbox Code Playgroud)
所以我的问题是:在Accord或Aforge中有一个函数可以获得与Photoshop的自动调色板相同的结果吗?如果没有,有一些库或脚本可以做到这一点?
谢谢你们.
我正在尝试将以前通过Excel工作表提供的一些功能实现到C#应用程序中,但Accord.NET的概率质量功能由于某种原因与excel功能不同.
在Excel中probabilty群发功能,使用这种方法
=BINOM.DIST(250; 3779; 0.0638; FALSE)
Result: 0.021944019794458
Run Code Online (Sandbox Code Playgroud)
当我尝试使用Accord.NET时
var binom = new BinomialDistribution(3779, 0.0638);
binom.ProbabilityMassFunction(250);
// Result: Infinity
Run Code Online (Sandbox Code Playgroud)
但累积分布似乎正常工作(除了最后几位数,但我认为这只是某种精度误差)
Excel中:
=BINOM.DIST(250; 3779; 0.0638; TRUE)
Result: 0.736156366002849
Run Code Online (Sandbox Code Playgroud)
Accord.NET:
var binom = new BinomialDistribution(3779, 0.0638);
binom.DistributionFunction(250);
// Result: 0.736156366002318
Run Code Online (Sandbox Code Playgroud)
为什么结果如此不同?有没有办法通过Accord获得Excel结果?
编辑: Extreme.Numerics计算与Excel相同的结果,但我不想使用此库,因为此库的许可证系统在过去总是导致麻烦.
编辑2:似乎某种溢出错误.
当我使用它时,我得到了正确的结果:
Math.Exp(binom.LogProbabilityMassFunction(250));
Run Code Online (Sandbox Code Playgroud)
任何想法为什么会发生这种情况?
我想使用Accord库以及AForge库中的一些东西.但是当我安装它时,我开始收到以下错误:
Error CS0433
The type 'IntPoint' exists in both
'AForge, Version=2.2.5.0, Culture=neutral, PublicKeyToken=c1db6ff4eaa06aeb' and
'Accord, Version=3.0.2.0, Culture=neutral, PublicKeyToken=fa1a88e29555ccf7'
Run Code Online (Sandbox Code Playgroud)
在这行代码上:
startingPoint = new IntPoint(point.X, point.Y);
Run Code Online (Sandbox Code Playgroud)
我怎样才能确保我只使用原始的AForge DLL?是否有解决方法?
我试过了
AForge.IntPoint
Run Code Online (Sandbox Code Playgroud)
但事实证明,雅阁使用相同的命名空间......!
我尝试使用来自C#库的Cobyla类来解决带约束的非线性优化问题.当约束是常量时,它可以正常工作,例如:
NonlinearConstraint(2, x => x[0] + x[1] <= 100.0)
Run Code Online (Sandbox Code Playgroud)
我需要在约束中使用变量(值需要由用户更改),例如:
double limit = 100.0;
NonlinearConstraint(2, x => x[0] + x[1] <= limit)
Run Code Online (Sandbox Code Playgroud)
但它不起作用.我得到了例外:
Accord.Math.dll中出现未处理的"System.NullReferenceException"类型异常
谁能告诉我如何正确定义NonlinearConstraint
变量的例子?
我在dot net core 1.1中使用Accord.net 3.7.0.
我使用的算法是朴素贝叶斯.学习机制的源代码如下:
public LearningResultViewModel NaiveBayes(int[][] inputs, int[] outputs)
{
// Create a new Naive Bayes learning
var learner = new NaiveBayesLearning();
// Learn a Naive Bayes model from the examples
NaiveBayes nb = learner.Learn(inputs, outputs);
#region test phase
// Compute the machine outputs
int[] predicted = nb.Decide(inputs);
// Use confusion matrix to compute some statistics.
ConfusionMatrix confusionMatrix = new ConfusionMatrix(predicted, outputs, 1, 0);
#endregion
LearningResultViewModel result = new LearningResultViewModel()
{
Distributions = nb.Distributions,
NumberOfClasses = nb.NumberOfClasses, …
Run Code Online (Sandbox Code Playgroud)