NMSE = 0.039
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <http51.mqh> | |
| extern string url = "http://localhost:8080/orders"; | |
| //this scripts sends an http post containing orders info each tick to this url | |
| int start() { | |
| string params [0,2]; | |
| int status[1]; // HTTP Status code | |
| int total=OrdersTotal(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require(nnet) | |
| require(caret) | |
| y = read.csv('http://www-psych.stanford.edu/~andreas/Time-Series/SantaFe/A.dat', header=F) | |
| y2 = read.csv('http://www-psych.stanford.edu/~andreas/Time-Series/SantaFe/A.cont', header=F) | |
| k = 40 | |
| n=100 | |
| y = y$V1/256 | |
| y2 = y2$V1/256 | |
| dat = sapply(1:k, function(a) c(rep(NA,a),y[1:(length(y)-a)]) ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % problem: we have a result, and many elements, find all combinations that sum up to the result | |
| function sol = knapsack01(maxCapacity, items) | |
| % knapsack problem with variables in {0,1} | |
| % Naive solution is O(n!), knapsack implementation is O(n*m) where n is | |
| % items length and m is weights length | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scipy import * | |
| M = 22 #ma for rsi | |
| N = 14 #rsi loopback | |
| thresh = [20,80] #rsi thresholds | |
| cost = 0.0001 # cost per trade (spread) | |
| price = 1.3 + 0.1*randn(100) + sin(linspace(0,10,100)) | |
| ma = ema(price, M) | |
| ri = rsindex(price-ma, N) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function [ as_ ] = polyMultiFeatures( items, k ) | |
| as = []; | |
| function recurse(a, i) | |
| % we should optimize and early stop a with length>k | |
| if i>size(items,2) | |
| if size(a,2)<=k | |
| as{end+1} = a; | |
| end | |
| return; | |
| end |

% generate a noisy signal
y = flipud( 3*sin(0.14*(1:128)')-1/20*(1:128)'+ (((1:128)'-64)/20).^2 + randn(128,1));
w=[-21;14;39;54;59;54;39;14;-21]/231; % http://en.wikipedia.org/wiki/Savitzky%E2%80%93Golay_filter#Tables_of_selected_convolution_coefficients
z = zeros(length(y)+10,1); % bigger
z(5:end-4) = y;
z(1:5) = flipud(z(6:10)); % symmetric padding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| % classic case, feature are by column | |
| function [Xnorm, Xmean, Xsigma] = normalizeFeature(X) | |
| Xmean = mean(X); | |
| Xnorm = bsxfun(@minus, X, Xmean); | |
| Xsigma = sqrt(sum(Xnorm.^2)/(size(Xnorm,1)-1)); | |
| Ynorm = bsxfun(@rdivide, Xnorm, Xsigma); | |
| % all this is equivalent to zscore(X) :) | |
| % for example collaborative filtering sets, classes are in row, and users in col |
OlderNewer


