Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

7. Apply a proper regression model- either Binary Logistic Regression or Linear

ID: 3753934 • Letter: 7

Question

7. Apply a proper regression model- either Binary Logistic Regression or Linear Regression. You need to think which one best fit with this dataset. Use the following for the selected model Task 1 1. Download house data from LMS and save it in your PC (working directory (folder). The data has 12 columns. Columns 1 to 11 are independent variables (X1 to XI1). Column 12 is the dependent variable (Y). o Assign random values to all Beta (B0 to B) parameters. All random values 2. MUST be real values between "0" and "I". Make SURE all parameters (B0 to B11) DO NOT have the same VALUE 3. Remove inconsistence data from some ROWS. For example, "bathrooms" values should be integers only (for example, 1, 2,4, 5, ...etc). If any row in "bathrooms" contains a real number (1.2, 3.4, 7.3,... etc), remove the complete row from the dataset. Please check other COLUMNS carefully. If you think any one of these o Use "Yest" for the predicated (estimated) value. Do not use different name. o Preform the steps of selected regression model. o If you selected Binary Logistic Regression, you need to calculate and print the accuracy. If you selected Linear Regression, you need to calculate and print the Sum of Squared Errors (SSE). 8. Apply Gradient Descent Algorithm (GDA) to optimise the selected regression model for 500 iterations. Check Algorithm 1 Pseudocode for GDA steps in Page 35 Lecture Note Week 6. Set Theta into 0.01. Use the following to calculate the partial derivative for Beta parameters: -For B0: B0-( 1 /No, of samples) * (Yest-Y) -For other parameters (B1 to B11) For i=1 to 11 columns should contains integer values only, remove the row(s) that contains real value(s). Write a code to perform the checking and removing process. Do not ask me which one should be checked or removed. Perform the following Data Exploration processes: Median: for all columns B. = ( 1 No. of samples) * (Nest-Y) *x.) 4. - Range: for all columns. - Frequency: for the following columns ONLY: "bathrooms", "floors", "condition" "grade 5. Check if the there are any "missing values" in the data. If you found "missing value" use "mean" to replace the "missing value" for real value and "min" for integer value. Check all columns value ranges. If you think normalisation is needed, use the "Min- Max" method. 6. 9 Prn the final results based on the selected regression model: either accuracy or SSE.

Explanation / Answer

Ghatei et al., 2012

Step 1: The velocity and position of all particles are randomly set to within pre-defined ranges.

Step 2: Velocity updating– At each iteration, the velocities of all particles are updated according to,

)()( ,22,11 ibestiibestiii pgrcpprcvv

(1)

where pi and vi are the position and velocity of particle i, respectively; pi,best and gi,best is the position with the

‘best’ objective value found so far by particle i and the entire population respectively; w is a parameter

controlling the dynamics of flying; r1 and r2 are random variables in the range [0,1]; c1 and c2 are factors

controlling the related weighting of corresponding terms. The random variables help the PSO with the ability of

stochastic searching.

Step 3: Position updating– The positions of all particles are updated according to,

i

v

i

p

i

p

(2)

After updating, pi should be checked and limited to the allowed range.

Step 4: Memory updating– Update pi,best and gi,best when condition is met,

)()( ,, bestiiibesti

i,bestiii,best

gfgfifgg

)f(p)f(pifpp

(3)

Where f(x) is the objective function to be optimized.

Step 5: Stopping condition– The algorithm repeats steps 2 to 4 until certain stopping conditions are met, such as a

pre-defined number of iterations. Once stopped, the algorithm reports the values of gbest and f(gbest) as its solution.

PSO [14] utilizes several searching points and the searching points gradually get close to the global

optimal point using its pbest and gbest. Initial positions of pbest and gbest are different. However, using thee different

direction of pb est and gbest, all agents gradually get close to the global optimum. Pseudo code of algorithm PSO

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote