Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python 3: Here is the starter code: # ---------------------------------------------------------- # # THIS CODE IS INCOMPLETE! BUT MAY HELP WHEN GETTING STARTED # # ----------------------------------------------------------

Using Python 3:

image text in transcribed

Here is the starter code:

# ---------------------------------------------------------- # # THIS CODE IS INCOMPLETE! BUT MAY HELP WHEN GETTING STARTED # # ---------------------------------------------------------- import numpy as np import numpy.linalg as la import pandas as pd import matplotlib.pyplot as plt

# Read in the data files

# Produce a Pandas histogram and plot (fill in appropriately) plt.figure(0) plt.title("a pretty histogram...") plt.figure(1) plt.title("a pretty plot...") plt.xlabel("an axis") plt.ylabel("an axis")

# Construct your A matrices A_linear = np.zeros(some_shape) A_quad = np.zeros(some_shape)

# Construct your b's b = np.zeros(some_shape)

# Solve the least squares problem

# See how well your model (i.e. weights) does on the validate data set

# Plot a bar graph of the false-positives and false-negatives bar_graph(fp_linear, fn_linear, fp_quad, fn_quad)

Breast Cancer Prediction Using Least Squares For this problem, you will develop models using the least squares method to predict whether a tumor is malignant M (cancerous / deadly) or benign B (non-cancerous / safe). Models similar to these could help doctors determine if a person is at risk for having cancer and consequently detect and treat the cancer earlier A tumor is a mass of abnormal tissue. Malignant and benign tumors have different cell growth characteristics (See the image to the right for an example). Some of the important tumor properties include the radius and the texture among others. X-ray imaging and biopsies (examining a small sample of the tumor under a microscope) can be used to determine these characteristics You will be given a large data set containing hundreds of patients along with properties of their tumors. You will solve least . squares problems with this data. You will then use the generated models to predict whether patients in another set have malignant M or benign B tumors We will be using the Python Data Analysis Library (Pandas) for importing the data and producing visualizations What Information Do I Have? (click to view) Least Squares Theory (dlick to view) Benign tumor Malig What Do I Need To Do? (click to view) INPUT labels: A list of strings which label the features in the data frame. You should include all these in your linear least-squares model subset_labels A list of strings indicating the names of the features which to include in the quadratic model bar_graph(fp_linear, fn_linear, fp_quad, fn_quad) : A function to plot a bar graph of error statistics OUTPUT b A 1-d numpy array that is the right-hand side to your least-squares problem weights_linear : The solution weights vector for your linear model weights quad: The solution weights vector for your quadratic model .A_linear: The matrix (2-d numpy array) for your linear least-squares model .A quad: The matrix (2-d numpy array) for your quadratic least-squares model Breast Cancer Prediction Using Least Squares For this problem, you will develop models using the least squares method to predict whether a tumor is malignant M (cancerous / deadly) or benign B (non-cancerous / safe). Models similar to these could help doctors determine if a person is at risk for having cancer and consequently detect and treat the cancer earlier A tumor is a mass of abnormal tissue. Malignant and benign tumors have different cell growth characteristics (See the image to the right for an example). Some of the important tumor properties include the radius and the texture among others. X-ray imaging and biopsies (examining a small sample of the tumor under a microscope) can be used to determine these characteristics You will be given a large data set containing hundreds of patients along with properties of their tumors. You will solve least . squares problems with this data. You will then use the generated models to predict whether patients in another set have malignant M or benign B tumors We will be using the Python Data Analysis Library (Pandas) for importing the data and producing visualizations What Information Do I Have? (click to view) Least Squares Theory (dlick to view) Benign tumor Malig What Do I Need To Do? (click to view) INPUT labels: A list of strings which label the features in the data frame. You should include all these in your linear least-squares model subset_labels A list of strings indicating the names of the features which to include in the quadratic model bar_graph(fp_linear, fn_linear, fp_quad, fn_quad) : A function to plot a bar graph of error statistics OUTPUT b A 1-d numpy array that is the right-hand side to your least-squares problem weights_linear : The solution weights vector for your linear model weights quad: The solution weights vector for your quadratic model .A_linear: The matrix (2-d numpy array) for your linear least-squares model .A quad: The matrix (2-d numpy array) for your quadratic least-squares model

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Next Generation Databases NoSQLand Big Data

Authors: Guy Harrison

1st Edition

1484213300, 978-1484213308

More Books

Students also viewed these Databases questions