QuestionQuestion

1. Pick your favorite data set (Kaggle, UCI, etc.) and figure out how you want to analyze it. You may choose either linear regression or a logistic regression gradient descent algorithm to be used with the data set.
2. This step is your first deliverable in writing via email to the instructor. You also need to schedule a meeting with the instructor to go over the details.
3. You must implement the code for this project using a high-level programming language: Java, C, C++. That means the machine leaning algorithms must be implemented from scratch using your choice of language. Keep in mind that your results must be clear and concise to be able to graph them using your favorite graphing tool. Your code must also be interactive as much as possible to be able to allow the user to interact with it.
4. You must be creative. Creativity and usefulness of your project is highly appreciated.
5. Visualization and analysis of the data is important, you may use Jupyter Notebooks to do so to help you visualize the data.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;

/**
* Linear Regression class
*/
public class LinearRegression {

    /**
    * A class to hold predictor variables matrix
    * And response variable matrix.
    * And name of each coefficient.
    */
    class Data {
       double[][] X;
       double[][] y;
       String[] names;
    }

    /**
    * This method take two 2D matrices and
    * multiplies them and return the resulted matrix.
    * @param a
    * @param b
    * @return
    */
    public static double[][] multiply(double[][] a, double[][] b) {
       int rowA = a.length;
       int colA = a[0].length;
       int rowB = b.length;
       int colB = b[0].length;
       double[][] result = new double[rowA][colB];
       if(colA == rowB) {
            for (int i = 0; i < rowA; i++) {
                for (int j = 0; j < colB; j++) {
                   for (int k = 0; k < rowB; k++) {
                        result[i][j] += a[i][k] * b[k][j];
                   }
                }
            }
       }
       return result;
    }

    /**
    * Utility method to print the matrix.
    * @param c
    */
    public static void printMatrix(double[][] c){
       int row = c.length;
       int col = c[0].length;

       for (int i=0; i<row; i++) {
            for (int j=0; j<col; j++) {
                System.out.print(c[i][j] + "       ");
            }
            System.out.println();
       }
    }

    /**
    * Utility method to print the predictor name and
    * its coefficient.
    * @param c
    * @param name
    */
    public static void printCoefficient(double[][] c, String[] name){
       int row = c.length;
       int col = c[0].length;

       for (int i=0; i<row; i++) {
            for (int j=0; j<col; j++) {
                System.out.print(name[i] + " : " + c[i][j] + "       ");
            }
            System.out.println();
       }
    }

    /**
    * This method finds the cofactor of a given matrix.
    * @param mat
    * @param factor
    * @param p
    * @param q
    * @param n
    */
    public static void coFactor(double[][] mat, double factor[][], int p, int q, int n){
       int i = 0;
       int j = 0;

       for(int r=0; r <n; r++) {
            for(int c=0; c<n;c++) {
                if(r != p && c != q) {
                   factor[i][j] = mat[r][c];
                   j++;
                   if(j == n-1){
                        j = 0;
                        i++;
                   }
                }
            }
       }
    }

    /**
    * This method find determinant of the matrix.
    * @param mat
    * @param n
    * @return
    */
    public static double determinant(double[][] mat, int n) {
       int N...

By purchasing this solution you'll be able to access the following files:
Solution.docx and Solution.java.

$75.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats