Welcome to the Simplilearn Community

Want to join the rest of our members? Sign up right away!

Sign Up

Machine Learning( Sept 14 - Oct 2nd,2020)| Vaishali

Hitesh H S

Well-Known Member
Staff member
Simplilearn Support
Hello, Can you help with setting up the local environment on desktop.
I have installed anaconda and python 3.8.X on my system.
Hi Shashi,
How can we convert month to quarter ?
1) Find mean quarterly sales by store (store_sales.csv)
Hi Rohit,

You can try this and let me know if this works in your case.

library(data.table) # load the data.table library
setDT(dfname) # dfname is your data frame name

newdfname <- dfname[, mean(columnname), keyby = .(year(Month), quarter(Month))] #Here month is the variable name, so you need to pass the right variable name.
str(newdfname)

I hope this helps you.

Happy Learning !!
 
Hello Maam

I need to ask about my project as for the applying model i'm splitting my data into train and test but not able to it so as i'm getting this error as i've attached name splitting error and while trying to use reshape for my data to change 1D to 2D i'm getting another error i've attached file as reshape error.

Please look into this as i'm having trouble with this part.
What i'm doing wrong
 

Attachments

  • spliting error.jpg
    spliting error.jpg
    210.6 KB · Views: 7
  • reshape error.jpg
    reshape error.jpg
    173.4 KB · Views: 6
Last edited:

Support Simplilearn(4685)

Moderator
Staff member
Alumni
Hello Maam

I need to ask about my project as for the applying model i'm splitting my data into train and test but not able to it so as i'm getting this error as i've attached name splitting error and while trying to use reshape for my data to change 1D to 2D i'm getting another error i've attached file as reshape error.

Please look into this as i'm having trouble with this part.
What i'm doing wrong
Hi Devika,

Can you try the below code,
model_lr.fit(x_train.values.reshape(-1,1),y_train)

Thank You
 
Hi,
I tried plotting decision tree on horses data set using the code below. If you would like to try it out:

import matplotlib.pyplot as plt

from sklearn.tree import plot_tree

features = list(horse_encoded_df.columns)

plt.figure(figsize=(45,10))
s = plot_tree(dt_prune,
filled=True,
feature_names=features,
fontsize=16,
node_ids=True)
 

_28555

Member
Hi Vaishali,

Can we have deployment of model class or can you please show in class or new class or demo for this please will be great.

Thanks & Regards,
Indubhusan
 

_28555

Member
Hi Vaishali,

Can we have deployment of ML model. Is this possible show this in current going on classes or can it be shown in a demo class or any new class. Please help on this.

Thanks & Regards,
Praharaj
 

_28555

Member
Hello, Can you help with setting up the local environment on desktop.
I have installed anaconda and python 3.8.X on my system.
Hi Shashi,

For setting up, you just need to set up PYTHON_HOME to directory-name where python.exe file present in Anaconda installed directory. Ex: C:\Anaconda3\python.exe, so your PYTHON_HOME path should be 'C:\Anaconda3\'. After this, close all windows and anaconda command prompt or normal command prompt, type command as 'python -V' and check whether you are getting the python your version as 3.8.XX. If yes then you are done.

Regards,
Praharaj
 

_28555

Member
Hi Vaishali,
I am trying on 9.16 - Self Learning practice project: Model Selection. i am not getting what is the target column here mtcars.csv file. Please help me on it.

Regards,
Praharaj.
 
I'm trying Mercedes-Benz Greener Manufacturing Project in that I have calculated variance for all columns for TEST and Train Data set ..so what should we do for given question for the remove of var() of any column.
 

_28555

Member
Hi Vaishali,
I have done demo project from self learning 9.16 - project: Model Selection and uploaded here the html file. Here have i done any mistake, i am getting test accuracy 0.0. Kindly check and guide me what need to be rectified please.

Regards,
Praharaj
 

Attachments

  • Project - Model Selection.zip
    70.3 KB · Views: 12

Sonali Bodkhe

Active Member
hi vaishali,
i have implemented the mercedes benz project. however i am not getting any output for XGBoost. kindly guide.the code file is attached herewith
 

Attachments

  • MLProject1-Mercedes.pdf
    139.3 KB · Views: 44

Vaishali_26

Well-Known Member
Alumni
Hello Maam

I need to ask about my project as for the applying model i'm splitting my data into train and test but not able to it so as i'm getting this error as i've attached name splitting error and while trying to use reshape for my data to change 1D to 2D i'm getting another error i've attached file as reshape error.

Please look into this as i'm having trouble with this part.
What i'm doing wrong
Hi Vaishali,

Can we have deployment of ML model. Is this possible show this in current going on classes or can it be shown in a demo class or any new class. Please help on this.

Thanks & Regards,
Praharaj
Hi Praharaj ,

PFB the below link to know about ML model deployment using Flask.

https://towardsdatascience.com/how-to-easily-deploy-machine-learning-models-using-flask-b95af8fe34d4
 

Vaishali_26

Well-Known Member
Alumni
HI
I'm trying Mercedes-Benz Greener Manufacturing Project in that I have calculated variance for all columns for TEST and Train Data set ..so what should we do for given question for the remove of var() of any column.
Hi Devika,

I believe that we have discussed extensively about this in our class.
 

Vaishali_26

Well-Known Member
Alumni
Hi Vaishali,
I have done demo project from self learning 9.16 - project: Model Selection and uploaded here the html file. Here have i done any mistake, i am getting test accuracy 0.0. Kindly check and guide me what need to be rectified please.

Regards,
Praharaj
Hello Praharaj,

There is no error in the code. It is just that the model hasnt learnt the data well since the number of data points are very less.
So, have no worries :)
 
I have implemented the mercedes benz project. however i am not able to import XGBoost as it's giving me error of
ModuleNotFoundError: No module named 'xgboost'

Could you tell is my version is old or what i need to do i have stuck in last part only
 

Nishant_Singh

Well-Known Member
Staff member
Simplilearn Support
I have implemented the mercedes benz project. however i am not able to import XGBoost as it's giving me error of
ModuleNotFoundError: No module named 'xgboost'

Could you tell is my version is old or what i need to do i have stuck in last part only

Hi Devika,

The error is coming because you have not installed xgboost on your local system and thus you are getting this error.

For the project please use the Simplilearn Lab as it has all the major required libraries pre-installed in it.

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Do not worry, if you have a Windows OS where you have Anaconda installed in your local system then just follow the below guidelines to install "xgboost" module :

01. Close Jupyter Notebook, Anaconda Navigator and Anaconda Prompt (if running) on your Laptop/PC

02. GoTo Start Menu in your Windows OS

03. Type and search for "Anaconda Prompt" but do not open it yet

04. Right-click on "Anaconda Prompt" and choose "Run as administrator"

05. Click on "Yes" when prompted for permission

06. Type the below command manually in the "Anaconda Prompt" and then press the "Enter" button :

conda install -c anaconda py-xgboost -y

07. Wait for the installation to finish

08. Once done type the below command and again hit the "Enter" button :

exit

09. This will now close the "Anaconda Prompt" and now you can run a fresh instance of the Jupyter Notebook normally to use it

That's All...

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

If you are a Mac OS user then you just need to follow the below steps :

01. Close Jupyter Notebook, Anaconda Navigator and Anaconda Prompt (if running) on your Laptop/PC

02. GoTo Application Menu in your Mac OS

03. Click and Open the Terminal App.

04. Type the below command manually in the "Terminal App" in your Mac OS and then press the "Enter" button :

conda install -c anaconda py-xgboost -y

05. Wait for the installation to finish

06. Once done type the below command and again hit the "Enter" button :

exit

07. This will now close the "Terminal App" on your Mac OS and now you can run a fresh instance of the Jupyter Notebook normally to use it

That's All...

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Just follow the above instruction based on your OS type and then you will be able to install the "xgboost" package successfully in your respective OS on your local system.

I hope that this will help you.

Regards,
Nishant Singh
Lead Global Teaching Assistant
Simplilearn
 

Vidya V_1

Member
Hi,
I'm doing Project 2 i.e., Income Qualification.
while doing Random Forest Classifier, when trying to fit the model, i'm getting value error.

Attached an error. Please help here.
 

Attachments

  • Fit_Error.txt
    3 KB · Views: 10

_28555

Member
Hi Vaishali,
The last class time series code file with dataset you have shown is not uploaded to Google drive. Please help me on that.

Regards,
Praharaj
 
Last edited:

_28555

Member
I have implemented the mercedes benz project. however i am not able to import XGBoost as it's giving me error of
ModuleNotFoundError: No module named 'xgboost'

Could you tell is my version is old or what i need to do i have stuck in last part only


Hi Devika,

Have you got the result, i am also facing same problem, did you got the result at last..? I did as Nishant Singh suggested (conda install -c anaconda py-xgboost -y), but still getting the problem.


Regards,
Praharaj
 
Last edited:
Hello Vaishali

I was working on Project 1 and faced some challenges. please help me get through (refer code.html attached):

1. While performing Normalization using StandardScaler(), i was curious about the need to normalize categorical variables. I wanted to know if we can get the same results without normalizing. I checked Stackoverflow and other sites to realise that it is a common problem that differs for each dataset in which we can choose to normalize the set or not. Can you tell me what factor can help to decide if we need to Normalize the categorical vars? (see line: 126)

2. In my code line 130, i could not understand the reason that the (pca.explained_var_ratio_=
[0.07259862 0.06236596 0.05326307 0.03984829 0.0358896 0.03564767]) were not coming up as percentage of explained var shown by each Pc's as opposed to what we saw during our live class.

3. Line 137: Do we have other metrics methods (except rmse) to capture the accuracy of the XGboost Regression model. Please name them. Can we also calculate R2 score for XGBoost here?

4. Line 144: While removing low variance features using var() method, columns that were removed from train.csv were different from test.csv i.e. in train.csv ->
['X11', 'X93', 'X107', 'X233', 'X235', 'X268', 'X289', 'X290', 'X293', 'X297', 'X330', 'X347'], 12 features were removed but in
test.csv-> ['X257', 'X258', 'X295', 'X296', 'X369'], only 5 features were removed.
Does it lead to any un-detected errors in prediction? Or should we remove the same features from both the datasets??


Thanks
Abhinav
 

Attachments

  • Code_final.pdf
    74.5 KB · Views: 25
Also can you please suggest, how to convert variance threshold () output :ndarray into the previous dataframe after removing the zero var features. I tried using this, but could not resolve it. So i did it using the var() function only.
 

Sonali Bodkhe

Active Member
Hi Devika,

The error is coming because you have not installed xgboost on your local system and thus you are getting this error.

For the project please use the Simplilearn Lab as it has all the major required libraries pre-installed in it.

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Do not worry, if you have a Windows OS where you have Anaconda installed in your local system then just follow the below guidelines to install "xgboost" module :

01. Close Jupyter Notebook, Anaconda Navigator and Anaconda Prompt (if running) on your Laptop/PC

02. GoTo Start Menu in your Windows OS

03. Type and search for "Anaconda Prompt" but do not open it yet

04. Right-click on "Anaconda Prompt" and choose "Run as administrator"

05. Click on "Yes" when prompted for permission

06. Type the below command manually in the "Anaconda Prompt" and then press the "Enter" button :

conda install -c anaconda py-xgboost -y

07. Wait for the installation to finish

08. Once done type the below command and again hit the "Enter" button :

exit

09. This will now close the "Anaconda Prompt" and now you can run a fresh instance of the Jupyter Notebook normally to use it

That's All...

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

If you are a Mac OS user then you just need to follow the below steps :

01. Close Jupyter Notebook, Anaconda Navigator and Anaconda Prompt (if running) on your Laptop/PC

02. GoTo Application Menu in your Mac OS

03. Click and Open the Terminal App.

04. Type the below command manually in the "Terminal App" in your Mac OS and then press the "Enter" button :

conda install -c anaconda py-xgboost -y

05. Wait for the installation to finish

06. Once done type the below command and again hit the "Enter" button :

exit

07. This will now close the "Terminal App" on your Mac OS and now you can run a fresh instance of the Jupyter Notebook normally to use it

That's All...

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Just follow the above instruction based on your OS type and then you will be able to install the "xgboost" package successfully in your respective OS on your local system.

I hope that this will help you.

Regards,
Nishant Singh
Lead Global Teaching Assistant
Simplilearn


hi nishant can you plese provide me some notes on time series modelling with an example solved?
 

Vaishali_26

Well-Known Member
Alumni
Hi all,

I have uploaded the Time Series code along with dataset in Day 15 folder. Please check.
Please note that I have simplified the code and the dataset for better understanding.

Happy learning !
 

Nishant_Singh

Well-Known Member
Staff member
Simplilearn Support
Hi Devika,

Have you got the result, i am also facing same problem, did you got the result at last..? I did as Nishant Singh suggested (conda install -c anaconda py-xgboost -y), but still getting the problem.


Regards,
Praharaj


Hi Praharaj,

Please raise a ticket with the screenshot of the message that you get at the end of the installation so that my team can properly assist you.

Regards,
Nishant Singh
Lead Global Teaching Assistant
Simplilearn
 
Top