Back

Accord.NET Machine Learning

Hi,
From recent postings, I understand that QuantConnect integrates the Accord.NET framework along with the Accord Machine Learning library. I'm trying to implement a simple SVM. Everything seems to build fine; however, when I go to launch the backtest, I keep getting the Error: "Could not Load the Assembly Accord.MachineLearning".

Is the Machine Learning library from Accord really supported?
Update Backtest








Sorry about that Gene! I think an environment variable somewhere got reset. I added the variable back and its alive and kicking :) From now on the environment variable is set everytime we boot the cloud.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Jared,

Thanks for the quick response! It's working now in the QuantConnect IDE. Don't know if this is the right place to bring this up, but the same (or similar) problem seems to be present in the latest Git code for LEAN. When using the same code on Lean, a build error indicates the Accord.MachineLearning assembly seems to be missing or not working properly.
0

Glad to hear working :) Lean doesn't ship with the libraries because it would take a long time to download (there are many)! You can manually the ones you want to the Lean.Engine project through NuGet.

PS: For the future please post about Lean to Google Groups for general help, Gitter for chat, or GitHub for suspected Lean bugs.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Hi Jared,

I ran into another issue. It seems that the 'SequentialMinimalOptimizationRegression' (SMO) algorithm is not supported in the build of Accord used on QuantConnect. The SMO is needed to perform regression tasks using a Support Vector Machine. According to the Accord documentation:
To use this class, add a reference to the Accord.MachineLearning.GPL.dll assembly that resides inside the Release/GPL folder of the framework's installation directory.


Could you please enable this functionality in QuantConnect?

Thanks!

Here is the code that will not work in QuantConnect:
using QuantConnect.Data.Consolidators;
using QuantConnect.Indicators;
using QuantConnect.Data.Market;
using Accord.MachineLearning.VectorMachines;
using Accord.MachineLearning.VectorMachines.Learning;
using Accord.Statistics.Kernels;
namespace QuantConnect.Algorithm
{
/*
* QuantConnect University: FOREX - Using Currency Data
*
* QuantConnect allows you to use currency data for your backtest with a
* simple line of code. See the SecurityType.Forex below.
*/
public class TestStrategy : QCAlgorithm
{
AverageTrueRange _atr;

decimal _price;
string _symbol = "EURUSD";

public override void Initialize()
{
SetStartDate(2015, 1, 4);
SetEndDate(DateTime.Now.Date.AddDays(-1));
SetCash(10000);
AddSecurity(SecurityType.Forex, _symbol, Resolution.Minute);
_atr = ATR(_symbol, 14, MovingAverageType.Simple, Resolution.Daily);

// Create Kernel Support Vector Machine with a Polynomial Kernel of 2nd degree
var machine = new KernelSupportVectorMachine(new Polynomial(2), inputs: 2);

// Create the sequential minimal optimization teacher
// ***** WILL NOT WORK IN QUANTCONNECT --
var learn = new SequentialMinimalOptimizationRegression(machine, inputs, outputs);

// Construct Hour & Day Consolidators
var dayConsolidator = new TradeBarConsolidator(TimeSpan.FromDays(1));
var hourConsolidator = new TradeBarConsolidator(TimeSpan.FromHours (1));
dayConsolidator.DataConsolidated += OnDataDay;
hourConsolidator.DataConsolidated += OnDataHour;
SubscriptionManager.AddConsolidator(_symbol,dayConsolidator);
SubscriptionManager.AddConsolidator(_symbol,hourConsolidator);
}

public void OnData(TradeBars data)
{
if (!Portfolio.HoldStock)
{
Order("EURUSD", 1000);
Debug("Purchased EURUSD on " + Time.ToShortDateString());
}
}

private void OnDataDay(object sender,TradeBar consolidated)
{
_price = consolidated.Close;

if (!_atr.IsReady) return;

}

private void OnDataHour(object sender,TradeBar consolidated)
{
_price = consolidated.Close;
//Log (_hourwindow[0].Close.ToString());
//Log (_hourwindow [8].Close.ToString());
}

// Fire plotting events once per day:
public override void OnEndOfDay()
{
Plot("ATR", _atr);
Plot("ATR", _price);
}

}
}
0

Sorry for the delay Gene, it was a hectic few days! I'll look into this today. We're over due deploying a new cloud build as well.
0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Update Backtest





0

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed