Python代写作业,脚本script代写Multiple linear regression model

0 Comments

Rules: The scripts for the projects will be named exclusively multiReg.py and matrixHunt.py , respectively. A global (for both projects together) requirement file ( requirements.txt ) is also demanded. Requirement files can be generated automatically (your task is to find out how). A requirements.txt sample is provided at the end of this document. Any change in file

names will be penalized. Other files besides the two scripts and the requirements file will not be considered.

MULTIPLE LINEAR REGRESSION

This project aims to implement a multiple linear regression model (do not use modules or predefined functions for linear regression). In this type of model there are 2 or more variables: x_1, x_2, ..., x_n (the predictors) and the variable y (the response). The linear function is y = b_0 + b_1 * x_1 + b_2 * x_2 + ... + b_n * x_n . The coefficients b_0, ..., b_1 are optimized for the observations in the data set. The observations for the variables x_1, ..., x_n and y can be found in a file with the extension .reg placed in an undisclosed folder at https://adrianchifu.com/teachings/FEG/M2/project/. It is your job to

automatically find the file and import the data into your script. The last column of the .reg file is the y variable.

You must provide the coefficients ( b_0, ..., b_n ), the root squared mean error (RMSE) for your model and the graph corresponding to the plot of your data (see the graph and console interaction examples below).

Concepts to keep in mind: Integer, Float, etc.

Mathematical modules for basic functions Graph modules

Functions URL treatment

Formatted printing Loops (while, for) Conditions

Here is an example of console interaction. Note that this is only a recommendation. You are free to design the interactions as you consider.

Example of console interaction
Example of data ploting

MAGIC MATRIX OVERLAP TREASURE HUNTIn this project you must find all the .html files that are scattered through undisclosed folders at https://adrianchifu.com/teachings/FEG/M2/project/.Beware that other types of files exist together with the .html files ( .png , .reg , .docx , etc.). All files that do not have the extension .html must be ignored.Each .html file contains a table filled with values. You must convert the html tables into matrices (only numerical values must be considered ; the non numerical values must be replaced by 0). The number of table rows and the number of tablecolumns are not fixed. Thus, you may encounter, for instance, 3 x 3 tables, as well as 4 x 2 tables, or 10 x 9 tables and so on. The maximum size of a table is 10 x 10 . You must provide a final 10 x 10 matrix representing the overlap of all the discovered matrices. For instance, if there are 72 html files, you will obtain 72 matrices extracted from the corresponding html tables. The expected output consists in the overlap of all the matrices, resulted by adding overlapping matrix values element by element. The matrices are aligned by the upper left corner (see the example below).Each .html file also contains a title stating the table name. You must extract all table names and concatenate them (for example: the table name for the title This isthe SD52ENC9CE Table is SD52ENC9CE ). You must provide the final string containing all the concatenated table names.Concepts to keep in mind: VariablesConditions URL treatmentFolder structure management HTML parsingInput and Output Formatted Printing MatricesLists (lists of lists) Tables

Mathematical functions Strings, Integer, etc.

Loops (while, for) Length

Here is an example of 2 matrix overlap by addition ( 3 x 3 and 2 x 2 , respectively).

Example of matrix overlap

Here is an example of console interaction. Note that this is only a recommendation. You are free to design the interactions as you consider.

Example of console interaction

Here is the requirements.txt file sample.

Requirement file sample

Comments