You are to implement and evaluate three learning algorithms


Topic: Machine Learning for Trading

Overview -

You are to implement and evaluate three learning algorithms as Python classes: A "classic" Decision Tree learner, a Random Tree learner, and a Bootstrap Aggregating learner. Note that a Linear Regression learner is provided for you in the git repository. The classes should be named DTLearner, RTLearner, and BagLearner respectively. The Linear Regression learner is already named LinRegLearner.

Note that we are considering this a regression problem (not classification). So the goal for your learner is to return a continuous numerical result (not a discrete result). In this project we are ignoring the time order aspect of the data and treating it as if it is static data and time does not matter. In a later project we will make the transition to considering time series data.

You must write your own code for Decision Tree learning, Random Tree learning and bagging. You are NOT allowed to use other people's code to implement these learners.

The project has two main components: The code for your learners, which will be auto graded, and your report, report.pdf that should include the components listed below.

Your learners should be able to handle any number of dimensions in X from 2 to N.

Template and Data -

Instructions:

  • Attached, you will find a zip file "Assess learners.zip"
  • Data/: Contains data for you to test your learning code on.
  • LinRegLearner.py: An implementation of the LinRegLearner class. You can use it as a template for implementing your learner classes.
  • testlearner.py: Simple testing scaffold that you can use to test your learners.
  • grade_learners.py: This is the main script to test your code for the final grading. You cannot run this script, but you must take the test cases from this script and make sure your code will pass all the test cases.

In the Data/ directory you will find these files:

  • 3_groups.csv
  • ripple_.csv
  • simple.csv
  • winequality-red.csv
  • winequality-white.csv
  • winequality.names.txt
  • istanbul.csv

We will mainly be working with the istanbul data. This data includes the returns of multiple worldwide indexes for a number of days in history. The overall objective is to predict what the return for the MSCI Emerging Markets (EM) index will be on the basis of the other index returns. Y in this case is the last column to the right, and the X values are the remaining columns to the left (except the first column). The first column of data in this file is the date, which you should ignore. The grading script does this automatically for you, but you will have to handle it yourself when working on your report.

When the auto grader tests your code we will randomly select 60% of the data to train on and use the other 40% for testing.

The other files, besides istanbul.csv are there as alternative sets for you to test your code on. Each data file contains N+1 columns: X1, X2, ... XN, and Y.

Implement DTLearner -

Implement RTLearner -

Implement BagLearner -

Implement InsaneLearner -

Implement author() Method  -

Experiments and report -

Create a report that addresses the following questions. Use 11pt font and single spaced lines. We expect that a complete report addressing all the criteria would be at least 3 pages. It should be no longer than 3000 words. To encourage conciseness we will deduct 10 points if the report is too long. The report should be submitted as report.pdf in PDF format. Do not submit word docs or latex files. Include data as tables or charts to support each of your answers.

  • Does overfitting occur with respect to leaf_size? Consider the dataset istanbul.csv with both DTLearner and RTLearner. For which values of leaf_size does overfitting occur? Use RMSE as your metric for assessing overfitting. Support your assertion with graphs/charts. (Don't use bagging).
  • Can bagging reduce or eliminate overfitting with respect to leaf_size? To investigate this choose a fixed number of bags to use and vary leaf_size to evaluate. Do Random Trees provide any advantage in this respect? Provide charts and/or tables to validate your conclusions.
  • Quantitatively compare "classic" decision trees (DTLearner) versus random trees (RTLearner). In which ways is one method better than the other?

Hints & resources - "Official" course-based materials:

  • How to use a decision tree if you have one (Balch Youtube video)
  • How to build a decision tree & Random Trees (Balch Youtube video)
  • Media: How-to-learn-a-decision-tree.pdf Balch slides on decision trees
  • Media: Decision-tree-example.xlsx Example tabular version of decision tree

Additional supporting materials:

  • You may be interested to take a look at Andew Moore's slides on instance based learning.
  • A definition of correlation which we'll use to assess the quality of the learning.
  • Bootstrap Aggregating
  • AdaBoost
  • numpycorrcoef
  • numpyargsort
  • RMS error

Extra Credit -

Implement boosting as part of BagLearner. How does boosting affect performance compared to not boosting? Does overfitting occur as the number of bags with boosting increases? Create your own dataset for which overfitting occurs as the number of bags with boosting increases.

Submit your report regarding boosting as report-boosting.pdf.

Attachment:- Assignment Files.rar

Request for Solution File

Ask an Expert for Answer!!
Python Programming: You are to implement and evaluate three learning algorithms
Reference No:- TGS02442730

Expected delivery within 24 Hours