Implement and evaluate three learning algorithms as python

Assignment Help Python Programming
Reference no: EM131647199

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

Reference no: EM131647199

Questions Cloud

What does statistically significant mean in given context : Swimming. Recently, a group of adults who swim regularly for exercise were evaluated for depression. It turned out that these swimmers were less likely.
What roles or role are discussed in this article : In the article "Knowing What to Do is Not Enough" by Jeffrey Pfeffer and Robert Sutton, What roles or role are discussed in this article?
What level of government should have primary responsibility : What level of government should have primary responsibility for issue? Assess whether constitutional distribution of power for your policy area is effective.
How will we randomize the procedure of dowsing : Dowsing. Before drilling for water, many rural homeowners hire a dowser (a person who claims to be able to sense the presence of underground water.
Implement and evaluate three learning algorithms as python : You are to implement and evaluate three learning algorithms as Python classes: A "classic" Decision Tree learner, a Random Tree learner
Report on new accounts created on payment plans : You are an account manager for Inland Jewelers, a regional company that makes custom class rings for graduating seniors.
Discuss a fractured right ulna and radius : Mackenzie Ann is a 12 year old scheduled for discharge from the Emergency Department after a gymnastics incident resulted in a fractured right ulna and radius
Benefits of alert-based decision support management system : Describe the benefits of an alert-based decision support management system for healthcare organizations today. Y
What is the implied valuation of a life year : whereas Treatment B provides an improvement of 0.2 QALYs at a cost of $5,000. Which treatment will planners prefer by cost-efficiency criteria?

Reviews

len1647199

9/18/2017 6:02:19 AM

Topic: Machine Learning for Trading. Detailed Question: Python Coding Assignment. Be sure to follow these instructions diligently! Your code as RTLearner.py, DTLearner.py, InsaneLearner.py and BagLearner.py. Your report as report.pdf.

len1647199

9/18/2017 6:02:07 AM

Code - DTLearner in sample/out of sample test, auto grade 5 test cases (4 using istanbul.csv, 1 using another data set), 3 points each: 15 points. For each test 60% of the data will be selected at random for training and 40% will be selected for testing. Success criteria for each of the 5 tests: 1) Does the correlation between predicted and actual results for in sample data exceed 0.95 with leaf_size = 1? 2) Does the correlation between predicted and actual results for out of sample data exceed 0.15 with leaf_size=1? 3) Is the correlation between predicted and actual results for in sample data below 0.95 with leaf_size = 50? 4) Does the test complete in less than 10 seconds (i.e. 50 seconds for all 5 tests)?

len1647199

9/18/2017 6:02:01 AM

Required: Your code must implement a Random Tree learner. Your project must be coded in Python 2.7.x. Your code must run on one of the university-provided computers (e.g. buffet02.cc.gatech.edu). Your code must run in less than 5 seconds on one of the university-provided computers. The code you submit should NOT include any data reading routines. The provided testlearner.py code rads data for you. The code you submit should NOT generate any output: No prints, no charts, etc.

Write a Review

Python Programming Questions & Answers

  Write a python program to implement the diff command

Without using the system() function to call any bash commands, write a python program that will implement a simple version of the diff command.

  Write a program for checking a circle

Write a program for checking a circle program must either print "is a circle: YES" or "is a circle: NO", appropriately.

  Prepare a python program

Prepare a Python program which evaluates how many stuck numbers there are in a range of integers. The range will be input as two command-line arguments.

  Python atm program to enter account number

Write a simple Python ATM program. Ask user to enter their account number, and print their initail balance. (Just make one up). Ask them if they wish to make deposit or withdrawal.

  Python function to calculate two roots

Write a Python function main() to calculate two roots. You must input a,b and c from keyboard, and then print two roots. Suppose the discriminant D= b2-4ac is positive.

  Design program that asks user to enter amount in python

IN Python Design a program that asks the user to enter the amount that he or she has budget in a month. A loop should then prompt the user to enter his or her expenses for the month.

  Write python program which imports three dictionaries

Write a Python program called hours.py which imports three dictionaries, and uses the data in them to calculate how many hours each person has spent in the lab.

  Write python program to create factors of numbers

Write down a python program which takes two numbers and creates the factors of both numbers and displays the greatest common factor.

  Email spam filter

Analyze the emails and predict whether the mail is a spam or not a spam - Create a training file and copy the text of several mails and spams in to it And create a test set identical to the training set but with different examples.

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Create a simple and responsive gui

Please use primarily PHP or Python to solve the exercise and create a simple and responsive GUI, using HTML, CSS and JavaScript.Do not use a database.

  The program is to print the time

The program is to print the time in seconds that the iterative version takes, the time in seconds that the recursive version takes, and the difference between the times.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd