{
  "id": 5966,
  "title": "Share your approach ",
  "content": "<p>I am not in top 10. But I have used a lot from what others have done, especially from Miroslaw Horbal. So I want to share what I have done. Hopefully, those in top 10 could give us some thoughts. If those winners can share, that will be the best.&nbsp;</p>\n<p>I have used two approaches:</p>\n<p>1. use gbm to do feature selection. Then use linear regression with l1 loss, you can find Miroslaw's code:&nbsp;<a href=\"http://www.kaggle.com/c/battlefin-s-big-data-combine-forecasting-challenge/forums/t/5582/the-hint-thread\">here</a>. This approach is simple. But it costs a lot of time. To do feature selection, it costs me around 24 hours in a server with 20 threads. But I have a server with 16 cores, 32 threads. So it's fine for me. I have uploaded the result of feature selection. You can download it directly, and put it into output dir.&nbsp;</p>\n<p>2. use another model, can I say it as ar model. This also comes from Miroslaw's sharing:&nbsp;<a href=\"http://www.kaggle.com/c/battlefin-s-big-data-combine-forecasting-challenge/forums/t/5582/the-hint-thread?page=3\">here</a>. I defined the method as this:</p>\n<p>p = a0 * x0 + (1-a0)*a1*x1 + (1-a0)(1-a1)a2*x2 + ... + (1-a0)(1-a1)...(1-an-1) an xn + b.</p>\n<p>To minimize the function, we have to define cost and gradient. You can refer to my code. This approach is quite efficient, it just costs me a few minutes. From private scores, this model is also better.&nbsp;</p>\n<p>With the first approach, public score: 0.41820 private score: 0.42668</p>\n<p>With the second approach, public score: 0.41833 private score: 0.42532</p>\n<p>To run the code:</p>\n<p>mkdir data, output, res</p>\n<p>python2 dataProcess.py</p>\n<p>python2 model linr se</p>\n<p>python2 model ar</p>\n<p>&nbsp;</p>",
  "comments": [
    {
      "id": 32324,
      "author_name": "Sergey Yurgenson",
      "author_url": "",
      "post_date": "2013-10-14T18:33:18.230000",
      "content": "<p>My model was designed with one main principle in mind: to make model as simple as possible and as stable as possible to avoid overfitting. My final submission was a weighted mean of three very similar models. Blending, however, generated very small gain in this particular case. That is why here I will be describing single model that was a part of the blend. This model by itself has 0.40959 score on public leaderboard and 0.42378 on private, which is enough to be #5 on public and #3 on private leaderboards.</p>\n<p>My algorithm was written on Matlab and code will be provided below. The main idea of algorithm is to use linear regression model (robust regression) using small number of predictors, which are chosen based on p-value of slops of each potential predictor.</p>\n<p>Code is not very vectorized because I found loops to be easy to modify for new idea testing and significantly more fool-proof.</p>\n<p><br>Read data and save in convenient Matlab format</p>\n<p>training_targets= dlmread('trainLabels.csv',',',1,1);</p>\n<p>for n=1:510</p>\n<p>inputs(:,:,n)=dlmread([num2str(n) '.csv'],',',1,0);</p>\n<p>end</p>\n<p>save('training_targest.mat','training_targets');</p>\n<p>save('inputs.mat','inputs');</p>\n<p><br>Load saved data and create naive predictions (last available price)</p>\n<p>load('inputs.mat');</p>\n<p>last_price=inputs(end,1:198,:);</p>\n<p>naive_submission=squeeze(last_price(:,:,201:end))';</p>\n<p>naive_training=squeeze(last_price(:,:,1:200))';</p>\n<p><br>Load saved targets and modify them. As training targets I used not prices to predict but difference between last known prices and prices to predict</p>\n<p>load('training_targest.mat');</p>\n<p>training_targets_mod=training_targets-naive_training;</p>\n<p><br>Clean data. Make sure that first raw of data is zero.</p>\n<p><br>inputs(1,:,:)=0;</p>\n<p><br>Clean data. Find situations when stock price changes by more than 40 % and assume that it is a data entry error, divide by 100.</p>\n<p><br>% direct inefficient way</p>\n<p>for n=1:198</p>\n<p>for m=1:200</p>\n<p>if abs(inputs(end,n,m))&gt;40</p>\n<p>inputs(:,n,m)=inputs(:,n,m)/100;</p>\n<p>training_targets_mod(m,n)=training_targets_mod(m,n)/100;</p>\n<p>end</p>\n<p>end</p>\n<p>end</p>\n<p>last_data=squeeze(inputs(end,:,:))';</p>\n<p><br>Now the main part</p>\n<p><br><br>warning off all</p>\n<p><br>use last price as a default submission</p>\n<p><br>submission=naive_submission;</p>\n<p><br>only last price stocks will be considered to be used as predictors (inclusion of additional &#8220;sentiment&#8221; predictors did not improve CV scores)</p>\n<p>&nbsp;</p>\n<p>pred_to_try=1:198;</p>\n<p><br>do for each stock separately</p>\n<p>&nbsp;</p>\n<p>for T=1:198</p>\n<p>P=NaN(1,numel(pred_to_try));</p>\n<p><br>Try last price of each stock as possible predictor for targeted stock</p>\n<p><br>for M=1:numel(pred_to_try)</p>\n<p>mai=pred_to_try(M);</p>\n<p>mean1=mean(last_data(:,mai));</p>\n<p>std1=std(last_data(:,mai));</p>\n<p>mean2=mean(training_targets_mod(:,T));</p>\n<p>std2=std(training_targets_mod(:,T));</p>\n<p>&nbsp;</p>\n<p>remove outliers</p>\n<p><br>good_ind=find(last_data(1:200,mai)&lt;mean1+std1*6&nbsp;&nbsp; &amp; &nbsp; last_data(1:200,mai)&gt;mean1-std1*6&nbsp;&nbsp; &amp;&nbsp;&nbsp; training_targets_mod(:,T)&lt;mean2+std2*6&nbsp;&nbsp; &amp; &nbsp; training_targets_mod(:,T)&gt;mean2-std2*6);</p>\n<p><br><br>calculate robust fit and save p value for each fit</p>\n<p>[b,stat] = robustfit(last_data(good_ind,mai),training_targets_mod(good_ind,T),'bisquare',8);</p>\n<p>P(M)=stat.p(2);</p>\n<p>end</p>\n<p>&nbsp;</p>\n<p>[maB_all, maBind_all]=sort(abs(P),'ascend');</p>\n<p><br>If we have small p values then use two predictors with smallest p values for the fit (without bias), else keep default last price prediction</p>\n<p><br>if maB_all(2)&lt;0.04</p>\n<p>maBind=pred_to_try(maBind_all(1));</p>\n<p>maBind2=pred_to_try(maBind_all(2));</p>\n<p>mean1=mean(last_data(:,maBind));</p>\n<p>std1=std(last_data(:,maBind));</p>\n<p>mean2=mean(training_targets_mod(:,T));</p>\n<p>std2=std(training_targets_mod(:,T));</p>\n<p>good_ind=find(last_data(1:200,maBind)&lt;mean1+std1*6 &amp; last_data(1:200,maBind)&gt;mean1-std1*6 &amp; training_targets_mod(:,T)&lt;mean2+std2*6 &amp; training_targets_mod(:,T)&gt;mean2-std2*6);</p>\n<p>[b2,stat] = robustfit(last_data(good_ind,[maBind, maBind2]),training_targets_mod(good_ind,T),'bisquare',8,'off');</p>\n<p>submission(:,T)=naive_submission(:,T)+(last_data(201:end,maBind2)*b2(2)+last_data(201:end,maBind)*b2(1))*0.5;</p>\n<p><br>coefficient 0.5 was calculated using CV</p>\n<p><br>end</p>\n<p>end</p>\n<p><br>Small postprocessing. If value did not change during last 30 min then use that price as a prediction. (Possible early end of trading day, stock trade was halted and so on)</p>\n<p><br>for d=201:510</p>\n<p>for s=1:198</p>\n<p>if std(inputs(50:end,s,d))&lt;10e-10</p>\n<p>submission(d-200,s)=naive_submission(d-200,s);</p>\n<p>end</p>\n<p>end</p>\n<p>end</p>\n<p><br>Make submission file</p>\n<p><br>fout_name=[filename '.csv'];</p>\n<p>fid_out=fopen(fout_name,'w');</p>\n<p>fprintf(fid_out,'FileId');</p>\n<p>&nbsp;</p>\n<p>for n=1:198</p>\n<p>fprintf(fid_out,[',O' num2str(n)]);</p>\n<p>end</p>\n<p>fprintf(fid_out,'\\n');</p>\n<p>&nbsp;</p>\n<p>for n1=1:size(submission,1)</p>\n<p>fprintf(fid_out,'%i',n1+200);</p>\n<p>for n2=1:size(submission,2)</p>\n<p>fprintf(fid_out,'%s',',');</p>\n<p>fprintf(fid_out,'%8.6f', submission(n1,n2));</p>\n<p>end</p>\n<p>fprintf(fid_out,'\\n');</p>\n<p>end</p>\n<p>&nbsp;</p>\n<p>fclose(fid_out)</p>\n<p>&nbsp;</p>\n<p><br>I tried larger number of predictors for regression and regression with 3 predictors was part of the final blend. If I increased number of predictors further CV score started degrading. I also tried slightly different predictors. Last price predictor is essentially change of stock price from previous day close to 1:55 today. I was exploring change of prices from today opening (9:00), 9:05, 9:10 and so on. Only change from 9:15 to 1:55 looked promising. Model with two predictors based on 9:15 to 1:55 price change was a third model in the final blend.</p>\n<p>Sergey Yurgenson</p>",
      "votes": 12,
      "replies": []
    },
    {
      "id": 32617,
      "author_name": "BreakfastPirate",
      "author_url": "",
      "post_date": "2013-10-24T02:02:55.977000",
      "content": "<p>A high-level description of my approach is:</p>\n<p>1. Group securities into groups according to price movement correlation.</p>\n<p>2. For each security group, use I146 to build a &#8220;decision stump&#8221; (a 1-split decision tree with 2 leaf nodes).</p>\n<p>3. For each leaf node, build a model of the form Prediction = m * Last Observed Value. For each leaf node, find m that minimizes MAE. Rows that most-improved or most-hurt MAE with respect to m=1.0 were not included.</p>\n<p>The R code is attached in a text file. &nbsp;It is kind of cryptic since it evolved over time.</p>",
      "votes": 4,
      "replies": []
    },
    {
      "id": 32099,
      "author_name": "n3n7i",
      "author_url": "",
      "post_date": "2013-10-08T02:00:09.817000",
      "content": "<p>Hi</p>\n<p>Well, this was my first crack at predicting a time series, and it's a pretty tricky set, so i think 90% of my approach must've been trial and error =)</p>\n<p>a few things i did try.. #1 running autoencoders across the 198 outputs. this was probably the first thing i tried, not very good for making predictions ;D but it still seems reasonable as some sort of post-predictive smoothing.</p>\n<p>#2 a few centroid variants, running along sections of the series. plenty of data this way, using a few folds you can easily be in excess of 400,000 examples with labels. Minibatches / short number of iterations and centroids kept the training time fair (usually under a minute ;)</p>\n<p>#3 much the same as #2 with squared error neural nets.. training error was definitely better, but the generalized error was about the same.</p>",
      "votes": 1,
      "replies": []
    },
    {
      "id": 120239,
      "author_name": "YueWang",
      "author_url": "",
      "post_date": "2016-05-16T16:39:19.930000",
      "content": "<p>[quote=Dirk Gently;32633]</p>\n<p>It seems I had submitted an older version of code. The latest version is attached.</p>\n<p>[/quote]</p>\n\n<p>Hi Dirk Gently, I am wondering if you could throw some lights on how to use your code... I didnt find the instruction.</p>\n\n<p>Many thanks</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 32636,
      "author_name": "Alexey Kaparis",
      "author_url": "",
      "post_date": "2013-10-24T14:34:03.273000",
      "content": "<p>Well, my best submission is very simple and a kinda stupid.</p>\n<p>It made the best result on private data and on public data. Idea is simple:</p>\n<p>1) disregard all features except prices</p>\n<p>2) build a trend line for each day per instrument</p>\n<p>3) consider that the more price is off the beginning of the day value the greater probability that trend line will reverse. In case of volitile market and when it is a sideways trend we won't loose pretty much in overal score. But in case there is a big movement we will be reducing an error.</p>\n<p>4) the final formula is: predicted value = last observed value - 5 * slope of a trend line</p>\n<p>&nbsp;</p>\n<p>The R code for the solution:</p>\n<p>test &lt;- read.csv(&quot;sampleSubmission.csv&quot;)</p>\n<p># build a trend line<br># I get predicted value using last observed value and reversed slope of trendline<br>my_functor &lt;- function(start1, end1, col, day) {<br>&nbsp; mc &lt;- lsfit(start1:end1, day[start1:end1,col])<br>&nbsp; a = day[end1,col] - 5*(mc$coefficients[2])<br>&nbsp; return(a)<br>}</p>\n<p># get data from day by day<br>training &lt;- function(indices, arr, my_functor) {<br>&nbsp; for (i in indices) {<br>&nbsp; &nbsp; a = paste(&quot;data/&quot;, arr[i, 1], &quot;.csv&quot;, sep = &quot;&quot;)<br>&nbsp; &nbsp; day &lt;- read.csv(a)<br>&nbsp; &nbsp; # process each instrument<br>&nbsp; &nbsp; for(j in 1:198) { <br>&nbsp; &nbsp; &nbsp; arr[i, j+1] = my_functor(1, 55, j, day)<br>&nbsp; &nbsp; }<br>&nbsp; }<br>&nbsp; return(arr)<br>}</p>\n<p>res &lt;- training(1:dim(test)[1], test, my_functor)<br>write.table(x = res, file = &quot;out_trend_minus_last.csv&quot;, quote = FALSE, sep = &quot;,&quot;, row.names = FALSE, col.names = TRUE)</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 32635,
      "author_name": "Ajay Deonarine",
      "author_url": "",
      "post_date": "2013-10-24T14:08:14.380000",
      "content": "<p>I had a pretty simple approach. &nbsp;Just used robust regression on the historical prices. &nbsp;I tried other more complex approaches, but this validated the best. &nbsp;I transformed the data a bit to have the historical prices horizontally. &nbsp;Then my sas code:</p>\n<p>proc robustreg data=train method = lts;<br> model y = hist2 hist52 hist53 hist54 hist55 / diagnostics leverage;<br>run;</p>\n<p>&nbsp;</p>\n<p>Final model was&nbsp;yhat = .0171 + -.0119 * hist2 + .0545 * hist52 + .0187 * hist53 + .6168 * hist54 + .3254 * hist55</p>\n<p>Where hist2 is the price at 9:30 and hist55 is the price at 1:55pm.&nbsp;</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 32633,
      "author_name": "Amit Juneja",
      "author_url": "",
      "post_date": "2013-10-24T13:59:39.523000",
      "content": "<p>It seems I had submitted an older version of code. The latest version is attached.</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 32632,
      "author_name": "Amit Juneja",
      "author_url": "",
      "post_date": "2013-10-24T13:10:19.543000",
      "content": "<p>NOTE: The code with this post is old version. See next post for the latest code.</p>\n<p>&nbsp;</p>\n<p>The code is attached in tar zipped format.</p>\n<p>Here is a high level description:</p>\n<p>To predict the stock A, multiple support vector machines are trained, each operating on historic values of a single stock or feature. That is, multiple estimates of stock A are computed separately from the provided historic values of stocks/features A, B, C, etc. The estimates are then combined linearly with weights inversely proportional to error in the estimates obtained in cross validation. SVM C values were optimized using 5-fold cross-validation. Radial Basis Function SVMs were found to be most effective and most easily trained.</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 32612,
      "author_name": "Brandon Kelly",
      "author_url": "",
      "post_date": "2013-10-23T22:09:30.470000",
      "content": "<p>I used a Hierarchical model and carried out Bayesian inference using Markov Chain Monte Carlo. I modeled the value of a security two hours in the future as having a Laplacian distribution with mean given by a linear combination of the values at the current time, the value 5 minutes earlier, and the value 10 minutes earlier. The free parameters are the constant, the regression coefficients, and the width of the Laplacian distribution. These were assumed to be different for each security. I chose this model because the maximum a posteriori estimate under this model corresponds to the estimate that minimizes the mean absolute error.In addition, I also modeled the joint distribution of the regression parameters (intercepts and slopes) as having a student's t-distribution with unknown mean and covariance matrix. In practice, I did not notice a large difference between the t model and a normal model, so I used the t model with a large value for the degrees of freedom. The distribution of the scale (variance) parameters for each security was modeled using a log-normal distribution with unknown mean and variance. I used broad priors for the group level parameters. I then used MCMC to obtain random draws from the joint posterior of the regression parameters for each security, the Laplacian scale parameters for each security, the mean and covariance matrix of the regression parameters over all securities, and the log-normal parameters for the distribution of the scale parameters. Then, for each of the MCMC samples I used the parameters to predict the value of the price two hours in the future. This gave me a set of random samples of the predicted price from its posterior probability distribution. I then computed my predictions ('best-fit' values) for the price of each security two hours in the future from the median of the predictions derived from the MCMC samples.</p>\n<p>When fitting the data I trained my model using both the values at 4pm for the training set, and the values at 2pm for the test set. This way I also use the data from the test set, and my model is not slanted strongly towards the training set. So, in other words, I tried to predict the values at 4pm for the training set using the values at 2pm, 1:55pm, and 1:50pm, and I tried to predict the values at 2pm for the test set using the values at noon, 11:55am, and 11:50am.</p>\n<p>Finally, I trained a gradient boosted regression tree on the residuals from the MCMC sampler predictions using the Box-Cox transformed sentiment data (the 'features'). However, the number of estimators used was very small, and this only resulting in a very small improvement; it is unclear how much this helped.</p>\n<p>My code can be found on my github page:</p>\n<p><a href=\"https://github.com/bckelly80/BDC.git\">https://github.com/bckelly80/BDC.git</a></p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 32601,
      "author_name": "Bruce Cragin",
      "author_url": "",
      "post_date": "2013-10-23T19:07:52.090000",
      "content": "<p>I posted a description of my model a couple of weeks ago in the Congratulations thread, and am referencing it here to put in context of the other submissions.&nbsp;</p>\n<p>&nbsp;</p>\n<p>https://drive.google.com/folderview?id=0B2BmvN6XEfggTVFVMzdYMTY2TGs&amp;usp=sharing</p>\n<p>&nbsp;</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 32579,
      "author_name": "Ed Ramsden",
      "author_url": "",
      "post_date": "2013-10-23T12:37:33.197000",
      "content": "<p>My model was a linear 1-level neural net.</p>\n<p>&nbsp;</p>\n<p>' Big Data Combine Code - Ed Ramsden<br>'<br>' Built under Microsoft Visual Basic Express 2008<br>'<br>' This code generates a prediction file with public score of 0.41744 <br>' and a private score of 0.42389. My final entry was from an ensemble <br>' of 20 linear models that each only used 30% of the available weights.<br>' The ensemble model only provided a small improvement (0.42364 private)<br>'</p>\n<p>Imports System.Math</p>\n<p>Public Class Form1</p>\n<p>Const NDAYS = 510<br> Const MAXY = 200<br> Const MAXX = 250<br> Const NSAMPLES = 55<br> Const NX = 244<br> Const NY = 198</p>\n<p>' daily data<br> Dim Yd(NDAYS, NSAMPLES, NY) As Single ' price movement data<br> Dim Xd(NDAYS, NSAMPLES, NX) As Single ' sentiment data (NOT USED)</p>\n<p>' Target Data<br> Dim Yt(NDAYS, MAXY) As Single ' close prices<br> Dim nTRain As Integer</p>\n<p>' linear perceptron weights<br> Dim WY(NY, NSAMPLES, NY) As Double, WX(NY, NSAMPLES, NX) As Double</p>\n<p><br> Sub LoadAllData()</p>\n<p>' loads all data<br> Dim i As Integer, j As Integer, folder As String, f As String, inline As String, ss() As String<br> Dim dix As Integer ' day index!</p>\n<p>' load all the daily data files<br> FolderBrowserDialog1.ShowDialog()<br> folder = FolderBrowserDialog1.SelectedPath<br> If folder = &quot;&quot; Then Return</p>\n<p>f = Dir(folder + &quot;\\*.csv&quot;)</p>\n<p><br> Do While f &lt;&gt; &quot;&quot;</p>\n<p>dix = Val(f)</p>\n<p>FileOpen(1, folder + &quot;\\&quot; + f, OpenMode.Input)<br> Me.Text = f : Application.DoEvents()<br> LineInput(1) ' throwaway header<br> For i = 1 To NSAMPLES<br> ss = LineInput(1).Split(&quot;,&quot;)<br> For j = 1 To NY<br> Yd(dix, i, j) = Val(ss(j - 1))<br> Next<br> For j = 1 To NX<br> Xd(dix, i, j) = Val(ss((j + NY) - 1))<br> Next<br> Next<br> FileClose(1)<br> f = Dir()<br> Loop</p>\n<p>' now get target (labels) data file</p>\n<p>OpenFileDialog1.Title = &quot;Load Target File&quot;<br> OpenFileDialog1.ShowDialog()<br> f = OpenFileDialog1.FileName</p>\n<p>FileOpen(1, f, OpenMode.Input)<br> LineInput(1)<br> nTRain = 0<br> While Not EOF(1)<br> nTRain += 1<br> ss = LineInput(1).Split(&quot;,&quot;)<br> For i = 1 To NY<br> Yt(nTRain, i) = Val(ss(i))<br> Next<br> End While<br> FileClose()<br> Me.Text = &quot;Done Loading&quot;</p>\n<p><br> End Sub</p>\n<p><br> Sub BigAssNNTrain(ByVal niter As Integer, ByVal eta As Double)</p>\n<p>' RES01 - 20 iterations, eta = 0.00000001<br> ' big-ass perceptron training only on delta of final result from last sample<br> ' each day is a training example</p>\n<p>Dim iter As Integer, yx As Integer, i As Integer, j As Integer, k As Integer, d As Integer<br> Dim mabs As Double, mabscnt As Integer, yest As Double, yerr As Double</p>\n<p><br> For iter = 1 To niter<br> mabs = 0 : mabscnt = 0<br> For d = 1 To 200<br> For yx = 1 To NY<br> ' estimate based on last sample<br> yest = Yd(d, NSAMPLES, yx)<br> For i = 1 To NSAMPLES - 1<br> For j = 1 To NY<br> yest += WY(yx, i, j) * Yd(d, i, j)<br> Next<br> Next<br> yerr = Yt(d, yx) - yest<br> mabs += Abs(yerr)<br> mabscnt += 1</p>\n<p>' back prop to weights<br> For i = 1 To NSAMPLES - 1<br> For j = 1 To NY<br> WY(yx, i, j) += eta * yerr * Yd(d, i, j)<br> Next<br> Next</p>\n<p>Next yx<br> Next d<br> TX.Text += iter.ToString + &quot; : &quot; + (mabs / mabscnt).ToString + vbCrLf : Application.DoEvents()<br> Next iter</p>\n<p><br> End Sub</p>\n<p>Sub BigAssNNExecute()</p>\n<p>Dim iter As Integer, yx As Integer, i As Integer, j As Integer, k As Integer, d As Integer<br> Dim mabs As Double, mabscnt As Integer, yest As Double, yerr As Double<br> Dim f As String</p>\n<p>SaveFileDialog1.Title = &quot;Save Result as...&quot;<br> SaveFileDialog1.FileName = &quot;*.csv&quot;<br> SaveFileDialog1.ShowDialog()<br> f = SaveFileDialog1.FileName<br> If f = &quot;*.csv&quot; Then Return</p>\n<p>FileOpen(1, f, OpenMode.Output)</p>\n<p>' write header<br> Print(1, &quot;FileId&quot;)<br> For i = 1 To 198<br> Print(1, &quot;,O&quot; + i.ToString)<br> Next<br> PrintLine(1)<br> For d = 201 To 510<br> Print(1, d.ToString)<br> For yx = 1 To NY<br> ' estimate based on last sample<br> yest = Yd(d, NSAMPLES, yx)<br> For i = 1 To NSAMPLES - 1<br> For j = 1 To NY<br> yest += WY(yx, i, j) * Yd(d, i, j)<br> Next<br> Next<br> Print(1, &quot;,&quot; + Trim(yest.ToString))<br> Next yx<br> PrintLine(1)</p>\n<p><br> Next<br> FileClose(1)</p>\n<p><br> End Sub</p>\n<p><br> Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click</p>\n<p>' This routine called from the 'RUN' button</p>\n<p>LoadAllData()<br> BigAssNNTrain(20, 0.00000001)<br> BigAssNNExecute()</p>\n<p>MsgBox(&quot;All Done&quot;)</p>\n<p>End Sub</p>\n<p><br>End Class</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 32509,
      "author_name": "Steve Armtrong",
      "author_url": "",
      "post_date": "2013-10-22T02:44:08.257000",
      "content": "<p>26th place presenting model in Miami at the BigDataCombine on October 25th.</p>\n<p>My model was a model that adjusted the guess value by a percentage for the group of equities chosen by using the features to pick ~1/2 of the equities to adjust their guess. &nbsp; This model actually beat the last known value in both the training set, public leader board and private leader board. &nbsp; This happened to be my first submission in my first contest, so there are one off errors in some of the arrays. &nbsp;Later corrected but those models never scored as well as this model. &nbsp; This program is also not optimized for output which was later added.&nbsp;</p>\n<p>The reason this model works well in this instance is because it tends to eliminate the equities that were not consistent in price movement. &nbsp;I choose to use all of the data as features. &nbsp;So in the output any feature with a negative number is an equity. How could stock 38(feature -159) have been a deciding factor. &nbsp;It really isn't. &nbsp;My use of features produced a semi random grouping of stocks. Approximately 50% of the equity set. &nbsp;I used the first 198 data points of each feature and took the mean. &nbsp;Any data point that was less then the mean created a map of which stocks to apply the percentage adjustment to. &nbsp;I then tested for MAE storing the lowest feature which produced the data set. &nbsp;I walked through a range of percentages to find the lowest MAE. &nbsp; This doesn't produce the most optimum set of equities because it only tested 442 combinations. &nbsp;My 26th place entry adjusted 90 equity prices and left the rest at the last know value.&nbsp;</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 32329,
      "author_name": "Big Bear",
      "author_url": "",
      "post_date": "2013-10-15T00:27:39.680000",
      "content": "<p>Unbelievable, we have seen a great approach.&nbsp;</p>\n<p>Thanks a lot, Sergey. : )</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 32092,
      "author_name": "Ulrich",
      "author_url": "",
      "post_date": "2013-10-07T16:17:06.137000",
      "content": "<p>I would ... but I'm very frustrated right now ...</p>",
      "votes": 0,
      "replies": []
    },
    {
      "id": 32059,
      "author_name": "Big Bear",
      "author_url": "",
      "post_date": "2013-10-06T03:19:08.640000",
      "content": "<p>No one wants to share? So sad... T T</p>",
      "votes": 0,
      "replies": []
    }
  ],
  "comment_count": 15,
  "messages": [
    {
      "id": 32324,
      "postDate": "2013-10-14T18:33:18.230Z",
      "content": "<p>My model was designed with one main principle in mind: to make model as simple as possible and as stable as possible to avoid overfitting. My final submission was a weighted mean of three very similar models. Blending, however, generated very small gain in this particular case. That is why here I will be describing single model that was a part of the blend. This model by itself has 0.40959 score on public leaderboard and 0.42378 on private, which is enough to be #5 on public and #3 on private leaderboards.</p>\n<p>My algorithm was written on Matlab and code will be provided below. The main idea of algorithm is to use linear regression model (robust regression) using small number of predictors, which are chosen based on p-value of slops of each potential predictor.</p>\n<p>Code is not very vectorized because I found loops to be easy to modify for new idea testing and significantly more fool-proof.</p>\n<p><br>Read data and save in convenient Matlab format</p>\n<p>training_targets= dlmread('trainLabels.csv',',',1,1);</p>\n<p>for n=1:510</p>\n<p>inputs(:,:,n)=dlmread([num2str(n) '.csv'],',',1,0);</p>\n<p>end</p>\n<p>save('training_targest.mat','training_targets');</p>\n<p>save('inputs.mat','inputs');</p>\n<p><br>Load saved data and create naive predictions (last available price)</p>\n<p>load('inputs.mat');</p>\n<p>last_price=inputs(end,1:198,:);</p>\n<p>naive_submission=squeeze(last_price(:,:,201:end))';</p>\n<p>naive_training=squeeze(last_price(:,:,1:200))';</p>\n<p><br>Load saved targets and modify them. As training targets I used not prices to predict but difference between last known prices and prices to predict</p>\n<p>load('training_targest.mat');</p>\n<p>training_targets_mod=training_targets-naive_training;</p>\n<p><br>Clean data. Make sure that first raw of data is zero.</p>\n<p><br>inputs(1,:,:)=0;</p>\n<p><br>Clean data. Find situations when stock price changes by more than 40 % and assume that it is a data entry error, divide by 100.</p>\n<p><br>% direct inefficient way</p>\n<p>for n=1:198</p>\n<p>for m=1:200</p>\n<p>if abs(inputs(end,n,m))&gt;40</p>\n<p>inputs(:,n,m)=inputs(:,n,m)/100;</p>\n<p>training_targets_mod(m,n)=training_targets_mod(m,n)/100;</p>\n<p>end</p>\n<p>end</p>\n<p>end</p>\n<p>last_data=squeeze(inputs(end,:,:))';</p>\n<p><br>Now the main part</p>\n<p><br><br>warning off all</p>\n<p><br>use last price as a default submission</p>\n<p><br>submission=naive_submission;</p>\n<p><br>only last price stocks will be considered to be used as predictors (inclusion of additional &#8220;sentiment&#8221; predictors did not improve CV scores)</p>\n<p>&nbsp;</p>\n<p>pred_to_try=1:198;</p>\n<p><br>do for each stock separately</p>\n<p>&nbsp;</p>\n<p>for T=1:198</p>\n<p>P=NaN(1,numel(pred_to_try));</p>\n<p><br>Try last price of each stock as possible predictor for targeted stock</p>\n<p><br>for M=1:numel(pred_to_try)</p>\n<p>mai=pred_to_try(M);</p>\n<p>mean1=mean(last_data(:,mai));</p>\n<p>std1=std(last_data(:,mai));</p>\n<p>mean2=mean(training_targets_mod(:,T));</p>\n<p>std2=std(training_targets_mod(:,T));</p>\n<p>&nbsp;</p>\n<p>remove outliers</p>\n<p><br>good_ind=find(last_data(1:200,mai)&lt;mean1+std1*6&nbsp;&nbsp; &amp; &nbsp; last_data(1:200,mai)&gt;mean1-std1*6&nbsp;&nbsp; &amp;&nbsp;&nbsp; training_targets_mod(:,T)&lt;mean2+std2*6&nbsp;&nbsp; &amp; &nbsp; training_targets_mod(:,T)&gt;mean2-std2*6);</p>\n<p><br><br>calculate robust fit and save p value for each fit</p>\n<p>[b,stat] = robustfit(last_data(good_ind,mai),training_targets_mod(good_ind,T),'bisquare',8);</p>\n<p>P(M)=stat.p(2);</p>\n<p>end</p>\n<p>&nbsp;</p>\n<p>[maB_all, maBind_all]=sort(abs(P),'ascend');</p>\n<p><br>If we have small p values then use two predictors with smallest p values for the fit (without bias), else keep default last price prediction</p>\n<p><br>if maB_all(2)&lt;0.04</p>\n<p>maBind=pred_to_try(maBind_all(1));</p>\n<p>maBind2=pred_to_try(maBind_all(2));</p>\n<p>mean1=mean(last_data(:,maBind));</p>\n<p>std1=std(last_data(:,maBind));</p>\n<p>mean2=mean(training_targets_mod(:,T));</p>\n<p>std2=std(training_targets_mod(:,T));</p>\n<p>good_ind=find(last_data(1:200,maBind)&lt;mean1+std1*6 &amp; last_data(1:200,maBind)&gt;mean1-std1*6 &amp; training_targets_mod(:,T)&lt;mean2+std2*6 &amp; training_targets_mod(:,T)&gt;mean2-std2*6);</p>\n<p>[b2,stat] = robustfit(last_data(good_ind,[maBind, maBind2]),training_targets_mod(good_ind,T),'bisquare',8,'off');</p>\n<p>submission(:,T)=naive_submission(:,T)+(last_data(201:end,maBind2)*b2(2)+last_data(201:end,maBind)*b2(1))*0.5;</p>\n<p><br>coefficient 0.5 was calculated using CV</p>\n<p><br>end</p>\n<p>end</p>\n<p><br>Small postprocessing. If value did not change during last 30 min then use that price as a prediction. (Possible early end of trading day, stock trade was halted and so on)</p>\n<p><br>for d=201:510</p>\n<p>for s=1:198</p>\n<p>if std(inputs(50:end,s,d))&lt;10e-10</p>\n<p>submission(d-200,s)=naive_submission(d-200,s);</p>\n<p>end</p>\n<p>end</p>\n<p>end</p>\n<p><br>Make submission file</p>\n<p><br>fout_name=[filename '.csv'];</p>\n<p>fid_out=fopen(fout_name,'w');</p>\n<p>fprintf(fid_out,'FileId');</p>\n<p>&nbsp;</p>\n<p>for n=1:198</p>\n<p>fprintf(fid_out,[',O' num2str(n)]);</p>\n<p>end</p>\n<p>fprintf(fid_out,'\\n');</p>\n<p>&nbsp;</p>\n<p>for n1=1:size(submission,1)</p>\n<p>fprintf(fid_out,'%i',n1+200);</p>\n<p>for n2=1:size(submission,2)</p>\n<p>fprintf(fid_out,'%s',',');</p>\n<p>fprintf(fid_out,'%8.6f', submission(n1,n2));</p>\n<p>end</p>\n<p>fprintf(fid_out,'\\n');</p>\n<p>end</p>\n<p>&nbsp;</p>\n<p>fclose(fid_out)</p>\n<p>&nbsp;</p>\n<p><br>I tried larger number of predictors for regression and regression with 3 predictors was part of the final blend. If I increased number of predictors further CV score started degrading. I also tried slightly different predictors. Last price predictor is essentially change of stock price from previous day close to 1:55 today. I was exploring change of prices from today opening (9:00), 9:05, 9:10 and so on. Only change from 9:15 to 1:55 looked promising. Model with two predictors based on 9:15 to 1:55 price change was a third model in the final blend.</p>\n<p>Sergey Yurgenson</p>",
      "votes": 12
    },
    {
      "id": 32051,
      "postDate": "2013-10-05T10:24:27.410Z",
      "content": "<p>I am not in top 10. But I have used a lot from what others have done, especially from Miroslaw Horbal. So I want to share what I have done. Hopefully, those in top 10 could give us some thoughts. If those winners can share, that will be the best.&nbsp;</p>\n<p>I have used two approaches:</p>\n<p>1. use gbm to do feature selection. Then use linear regression with l1 loss, you can find Miroslaw's code:&nbsp;<a href=\"http://www.kaggle.com/c/battlefin-s-big-data-combine-forecasting-challenge/forums/t/5582/the-hint-thread\">here</a>. This approach is simple. But it costs a lot of time. To do feature selection, it costs me around 24 hours in a server with 20 threads. But I have a server with 16 cores, 32 threads. So it's fine for me. I have uploaded the result of feature selection. You can download it directly, and put it into output dir.&nbsp;</p>\n<p>2. use another model, can I say it as ar model. This also comes from Miroslaw's sharing:&nbsp;<a href=\"http://www.kaggle.com/c/battlefin-s-big-data-combine-forecasting-challenge/forums/t/5582/the-hint-thread?page=3\">here</a>. I defined the method as this:</p>\n<p>p = a0 * x0 + (1-a0)*a1*x1 + (1-a0)(1-a1)a2*x2 + ... + (1-a0)(1-a1)...(1-an-1) an xn + b.</p>\n<p>To minimize the function, we have to define cost and gradient. You can refer to my code. This approach is quite efficient, it just costs me a few minutes. From private scores, this model is also better.&nbsp;</p>\n<p>With the first approach, public score: 0.41820 private score: 0.42668</p>\n<p>With the second approach, public score: 0.41833 private score: 0.42532</p>\n<p>To run the code:</p>\n<p>mkdir data, output, res</p>\n<p>python2 dataProcess.py</p>\n<p>python2 model linr se</p>\n<p>python2 model ar</p>\n<p>&nbsp;</p>",
      "votes": 5
    },
    {
      "id": 32617,
      "postDate": "2013-10-24T02:02:55.977Z",
      "content": "<p>A high-level description of my approach is:</p>\n<p>1. Group securities into groups according to price movement correlation.</p>\n<p>2. For each security group, use I146 to build a &#8220;decision stump&#8221; (a 1-split decision tree with 2 leaf nodes).</p>\n<p>3. For each leaf node, build a model of the form Prediction = m * Last Observed Value. For each leaf node, find m that minimizes MAE. Rows that most-improved or most-hurt MAE with respect to m=1.0 were not included.</p>\n<p>The R code is attached in a text file. &nbsp;It is kind of cryptic since it evolved over time.</p>",
      "votes": 4
    },
    {
      "id": 32099,
      "postDate": "2013-10-08T02:00:09.817Z",
      "content": "<p>Hi</p>\n<p>Well, this was my first crack at predicting a time series, and it's a pretty tricky set, so i think 90% of my approach must've been trial and error =)</p>\n<p>a few things i did try.. #1 running autoencoders across the 198 outputs. this was probably the first thing i tried, not very good for making predictions ;D but it still seems reasonable as some sort of post-predictive smoothing.</p>\n<p>#2 a few centroid variants, running along sections of the series. plenty of data this way, using a few folds you can easily be in excess of 400,000 examples with labels. Minibatches / short number of iterations and centroids kept the training time fair (usually under a minute ;)</p>\n<p>#3 much the same as #2 with squared error neural nets.. training error was definitely better, but the generalized error was about the same.</p>",
      "votes": 1
    },
    {
      "id": 120239,
      "postDate": "2016-05-16T16:39:19.930Z",
      "content": "<p>[quote=Dirk Gently;32633]</p>\n<p>It seems I had submitted an older version of code. The latest version is attached.</p>\n<p>[/quote]</p>\n\n<p>Hi Dirk Gently, I am wondering if you could throw some lights on how to use your code... I didnt find the instruction.</p>\n\n<p>Many thanks</p>"
    },
    {
      "id": 32636,
      "postDate": "2013-10-24T14:34:03.273Z",
      "content": "<p>Well, my best submission is very simple and a kinda stupid.</p>\n<p>It made the best result on private data and on public data. Idea is simple:</p>\n<p>1) disregard all features except prices</p>\n<p>2) build a trend line for each day per instrument</p>\n<p>3) consider that the more price is off the beginning of the day value the greater probability that trend line will reverse. In case of volitile market and when it is a sideways trend we won't loose pretty much in overal score. But in case there is a big movement we will be reducing an error.</p>\n<p>4) the final formula is: predicted value = last observed value - 5 * slope of a trend line</p>\n<p>&nbsp;</p>\n<p>The R code for the solution:</p>\n<p>test &lt;- read.csv(&quot;sampleSubmission.csv&quot;)</p>\n<p># build a trend line<br># I get predicted value using last observed value and reversed slope of trendline<br>my_functor &lt;- function(start1, end1, col, day) {<br>&nbsp; mc &lt;- lsfit(start1:end1, day[start1:end1,col])<br>&nbsp; a = day[end1,col] - 5*(mc$coefficients[2])<br>&nbsp; return(a)<br>}</p>\n<p># get data from day by day<br>training &lt;- function(indices, arr, my_functor) {<br>&nbsp; for (i in indices) {<br>&nbsp; &nbsp; a = paste(&quot;data/&quot;, arr[i, 1], &quot;.csv&quot;, sep = &quot;&quot;)<br>&nbsp; &nbsp; day &lt;- read.csv(a)<br>&nbsp; &nbsp; # process each instrument<br>&nbsp; &nbsp; for(j in 1:198) { <br>&nbsp; &nbsp; &nbsp; arr[i, j+1] = my_functor(1, 55, j, day)<br>&nbsp; &nbsp; }<br>&nbsp; }<br>&nbsp; return(arr)<br>}</p>\n<p>res &lt;- training(1:dim(test)[1], test, my_functor)<br>write.table(x = res, file = &quot;out_trend_minus_last.csv&quot;, quote = FALSE, sep = &quot;,&quot;, row.names = FALSE, col.names = TRUE)</p>"
    },
    {
      "id": 32635,
      "postDate": "2013-10-24T14:08:14.380Z",
      "content": "<p>I had a pretty simple approach. &nbsp;Just used robust regression on the historical prices. &nbsp;I tried other more complex approaches, but this validated the best. &nbsp;I transformed the data a bit to have the historical prices horizontally. &nbsp;Then my sas code:</p>\n<p>proc robustreg data=train method = lts;<br> model y = hist2 hist52 hist53 hist54 hist55 / diagnostics leverage;<br>run;</p>\n<p>&nbsp;</p>\n<p>Final model was&nbsp;yhat = .0171 + -.0119 * hist2 + .0545 * hist52 + .0187 * hist53 + .6168 * hist54 + .3254 * hist55</p>\n<p>Where hist2 is the price at 9:30 and hist55 is the price at 1:55pm.&nbsp;</p>"
    },
    {
      "id": 32633,
      "postDate": "2013-10-24T13:59:39.523Z",
      "content": "<p>It seems I had submitted an older version of code. The latest version is attached.</p>"
    },
    {
      "id": 32632,
      "postDate": "2013-10-24T13:10:19.543Z",
      "content": "<p>NOTE: The code with this post is old version. See next post for the latest code.</p>\n<p>&nbsp;</p>\n<p>The code is attached in tar zipped format.</p>\n<p>Here is a high level description:</p>\n<p>To predict the stock A, multiple support vector machines are trained, each operating on historic values of a single stock or feature. That is, multiple estimates of stock A are computed separately from the provided historic values of stocks/features A, B, C, etc. The estimates are then combined linearly with weights inversely proportional to error in the estimates obtained in cross validation. SVM C values were optimized using 5-fold cross-validation. Radial Basis Function SVMs were found to be most effective and most easily trained.</p>\n<p>&nbsp;</p>\n<p>&nbsp;</p>"
    },
    {
      "id": 32612,
      "postDate": "2013-10-23T22:09:30.470Z",
      "content": "<p>I used a Hierarchical model and carried out Bayesian inference using Markov Chain Monte Carlo. I modeled the value of a security two hours in the future as having a Laplacian distribution with mean given by a linear combination of the values at the current time, the value 5 minutes earlier, and the value 10 minutes earlier. The free parameters are the constant, the regression coefficients, and the width of the Laplacian distribution. These were assumed to be different for each security. I chose this model because the maximum a posteriori estimate under this model corresponds to the estimate that minimizes the mean absolute error.In addition, I also modeled the joint distribution of the regression parameters (intercepts and slopes) as having a student's t-distribution with unknown mean and covariance matrix. In practice, I did not notice a large difference between the t model and a normal model, so I used the t model with a large value for the degrees of freedom. The distribution of the scale (variance) parameters for each security was modeled using a log-normal distribution with unknown mean and variance. I used broad priors for the group level parameters. I then used MCMC to obtain random draws from the joint posterior of the regression parameters for each security, the Laplacian scale parameters for each security, the mean and covariance matrix of the regression parameters over all securities, and the log-normal parameters for the distribution of the scale parameters. Then, for each of the MCMC samples I used the parameters to predict the value of the price two hours in the future. This gave me a set of random samples of the predicted price from its posterior probability distribution. I then computed my predictions ('best-fit' values) for the price of each security two hours in the future from the median of the predictions derived from the MCMC samples.</p>\n<p>When fitting the data I trained my model using both the values at 4pm for the training set, and the values at 2pm for the test set. This way I also use the data from the test set, and my model is not slanted strongly towards the training set. So, in other words, I tried to predict the values at 4pm for the training set using the values at 2pm, 1:55pm, and 1:50pm, and I tried to predict the values at 2pm for the test set using the values at noon, 11:55am, and 11:50am.</p>\n<p>Finally, I trained a gradient boosted regression tree on the residuals from the MCMC sampler predictions using the Box-Cox transformed sentiment data (the 'features'). However, the number of estimators used was very small, and this only resulting in a very small improvement; it is unclear how much this helped.</p>\n<p>My code can be found on my github page:</p>\n<p><a href=\"https://github.com/bckelly80/BDC.git\">https://github.com/bckelly80/BDC.git</a></p>"
    },
    {
      "id": 32601,
      "postDate": "2013-10-23T19:07:52.090Z",
      "content": "<p>I posted a description of my model a couple of weeks ago in the Congratulations thread, and am referencing it here to put in context of the other submissions.&nbsp;</p>\n<p>&nbsp;</p>\n<p>https://drive.google.com/folderview?id=0B2BmvN6XEfggTVFVMzdYMTY2TGs&amp;usp=sharing</p>\n<p>&nbsp;</p>"
    },
    {
      "id": 32579,
      "postDate": "2013-10-23T12:37:33.197Z",
      "content": "<p>My model was a linear 1-level neural net.</p>\n<p>&nbsp;</p>\n<p>' Big Data Combine Code - Ed Ramsden<br>'<br>' Built under Microsoft Visual Basic Express 2008<br>'<br>' This code generates a prediction file with public score of 0.41744 <br>' and a private score of 0.42389. My final entry was from an ensemble <br>' of 20 linear models that each only used 30% of the available weights.<br>' The ensemble model only provided a small improvement (0.42364 private)<br>'</p>\n<p>Imports System.Math</p>\n<p>Public Class Form1</p>\n<p>Const NDAYS = 510<br> Const MAXY = 200<br> Const MAXX = 250<br> Const NSAMPLES = 55<br> Const NX = 244<br> Const NY = 198</p>\n<p>' daily data<br> Dim Yd(NDAYS, NSAMPLES, NY) As Single ' price movement data<br> Dim Xd(NDAYS, NSAMPLES, NX) As Single ' sentiment data (NOT USED)</p>\n<p>' Target Data<br> Dim Yt(NDAYS, MAXY) As Single ' close prices<br> Dim nTRain As Integer</p>\n<p>' linear perceptron weights<br> Dim WY(NY, NSAMPLES, NY) As Double, WX(NY, NSAMPLES, NX) As Double</p>\n<p><br> Sub LoadAllData()</p>\n<p>' loads all data<br> Dim i As Integer, j As Integer, folder As String, f As String, inline As String, ss() As String<br> Dim dix As Integer ' day index!</p>\n<p>' load all the daily data files<br> FolderBrowserDialog1.ShowDialog()<br> folder = FolderBrowserDialog1.SelectedPath<br> If folder = &quot;&quot; Then Return</p>\n<p>f = Dir(folder + &quot;\\*.csv&quot;)</p>\n<p><br> Do While f &lt;&gt; &quot;&quot;</p>\n<p>dix = Val(f)</p>\n<p>FileOpen(1, folder + &quot;\\&quot; + f, OpenMode.Input)<br> Me.Text = f : Application.DoEvents()<br> LineInput(1) ' throwaway header<br> For i = 1 To NSAMPLES<br> ss = LineInput(1).Split(&quot;,&quot;)<br> For j = 1 To NY<br> Yd(dix, i, j) = Val(ss(j - 1))<br> Next<br> For j = 1 To NX<br> Xd(dix, i, j) = Val(ss((j + NY) - 1))<br> Next<br> Next<br> FileClose(1)<br> f = Dir()<br> Loop</p>\n<p>' now get target (labels) data file</p>\n<p>OpenFileDialog1.Title = &quot;Load Target File&quot;<br> OpenFileDialog1.ShowDialog()<br> f = OpenFileDialog1.FileName</p>\n<p>FileOpen(1, f, OpenMode.Input)<br> LineInput(1)<br> nTRain = 0<br> While Not EOF(1)<br> nTRain += 1<br> ss = LineInput(1).Split(&quot;,&quot;)<br> For i = 1 To NY<br> Yt(nTRain, i) = Val(ss(i))<br> Next<br> End While<br> FileClose()<br> Me.Text = &quot;Done Loading&quot;</p>\n<p><br> End Sub</p>\n<p><br> Sub BigAssNNTrain(ByVal niter As Integer, ByVal eta As Double)</p>\n<p>' RES01 - 20 iterations, eta = 0.00000001<br> ' big-ass perceptron training only on delta of final result from last sample<br> ' each day is a training example</p>\n<p>Dim iter As Integer, yx As Integer, i As Integer, j As Integer, k As Integer, d As Integer<br> Dim mabs As Double, mabscnt As Integer, yest As Double, yerr As Double</p>\n<p><br> For iter = 1 To niter<br> mabs = 0 : mabscnt = 0<br> For d = 1 To 200<br> For yx = 1 To NY<br> ' estimate based on last sample<br> yest = Yd(d, NSAMPLES, yx)<br> For i = 1 To NSAMPLES - 1<br> For j = 1 To NY<br> yest += WY(yx, i, j) * Yd(d, i, j)<br> Next<br> Next<br> yerr = Yt(d, yx) - yest<br> mabs += Abs(yerr)<br> mabscnt += 1</p>\n<p>' back prop to weights<br> For i = 1 To NSAMPLES - 1<br> For j = 1 To NY<br> WY(yx, i, j) += eta * yerr * Yd(d, i, j)<br> Next<br> Next</p>\n<p>Next yx<br> Next d<br> TX.Text += iter.ToString + &quot; : &quot; + (mabs / mabscnt).ToString + vbCrLf : Application.DoEvents()<br> Next iter</p>\n<p><br> End Sub</p>\n<p>Sub BigAssNNExecute()</p>\n<p>Dim iter As Integer, yx As Integer, i As Integer, j As Integer, k As Integer, d As Integer<br> Dim mabs As Double, mabscnt As Integer, yest As Double, yerr As Double<br> Dim f As String</p>\n<p>SaveFileDialog1.Title = &quot;Save Result as...&quot;<br> SaveFileDialog1.FileName = &quot;*.csv&quot;<br> SaveFileDialog1.ShowDialog()<br> f = SaveFileDialog1.FileName<br> If f = &quot;*.csv&quot; Then Return</p>\n<p>FileOpen(1, f, OpenMode.Output)</p>\n<p>' write header<br> Print(1, &quot;FileId&quot;)<br> For i = 1 To 198<br> Print(1, &quot;,O&quot; + i.ToString)<br> Next<br> PrintLine(1)<br> For d = 201 To 510<br> Print(1, d.ToString)<br> For yx = 1 To NY<br> ' estimate based on last sample<br> yest = Yd(d, NSAMPLES, yx)<br> For i = 1 To NSAMPLES - 1<br> For j = 1 To NY<br> yest += WY(yx, i, j) * Yd(d, i, j)<br> Next<br> Next<br> Print(1, &quot;,&quot; + Trim(yest.ToString))<br> Next yx<br> PrintLine(1)</p>\n<p><br> Next<br> FileClose(1)</p>\n<p><br> End Sub</p>\n<p><br> Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click</p>\n<p>' This routine called from the 'RUN' button</p>\n<p>LoadAllData()<br> BigAssNNTrain(20, 0.00000001)<br> BigAssNNExecute()</p>\n<p>MsgBox(&quot;All Done&quot;)</p>\n<p>End Sub</p>\n<p><br>End Class</p>"
    },
    {
      "id": 32509,
      "postDate": "2013-10-22T02:44:08.257Z",
      "content": "<p>26th place presenting model in Miami at the BigDataCombine on October 25th.</p>\n<p>My model was a model that adjusted the guess value by a percentage for the group of equities chosen by using the features to pick ~1/2 of the equities to adjust their guess. &nbsp; This model actually beat the last known value in both the training set, public leader board and private leader board. &nbsp; This happened to be my first submission in my first contest, so there are one off errors in some of the arrays. &nbsp;Later corrected but those models never scored as well as this model. &nbsp; This program is also not optimized for output which was later added.&nbsp;</p>\n<p>The reason this model works well in this instance is because it tends to eliminate the equities that were not consistent in price movement. &nbsp;I choose to use all of the data as features. &nbsp;So in the output any feature with a negative number is an equity. How could stock 38(feature -159) have been a deciding factor. &nbsp;It really isn't. &nbsp;My use of features produced a semi random grouping of stocks. Approximately 50% of the equity set. &nbsp;I used the first 198 data points of each feature and took the mean. &nbsp;Any data point that was less then the mean created a map of which stocks to apply the percentage adjustment to. &nbsp;I then tested for MAE storing the lowest feature which produced the data set. &nbsp;I walked through a range of percentages to find the lowest MAE. &nbsp; This doesn't produce the most optimum set of equities because it only tested 442 combinations. &nbsp;My 26th place entry adjusted 90 equity prices and left the rest at the last know value.&nbsp;</p>"
    },
    {
      "id": 32329,
      "postDate": "2013-10-15T00:27:39.680Z",
      "content": "<p>Unbelievable, we have seen a great approach.&nbsp;</p>\n<p>Thanks a lot, Sergey. : )</p>"
    },
    {
      "id": 32092,
      "postDate": "2013-10-07T16:17:06.137Z",
      "content": "<p>I would ... but I'm very frustrated right now ...</p>"
    },
    {
      "id": 32059,
      "postDate": "2013-10-06T03:19:08.640Z",
      "content": "<p>No one wants to share? So sad... T T</p>"
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-19T16:34:10Z",
  "competition_id": 3540,
  "competition_slug": "battlefin-s-big-data-combine-forecasting-challenge",
  "team_id": 57194,
  "solution_url": "/competitions/battlefin-s-big-data-combine-forecasting-challenge/writeups/big-bear-share-your-approach"
}