practical-machine-learning-with-python icon indicating copy to clipboard operation
practical-machine-learning-with-python copied to clipboard

Master the essential skills needed to recognize and solve complex real-world problems with Machine Learning and Deep Learning by leveraging the highly popular Python Machine Learning Eco-system.

Results 24 practical-machine-learning-with-python issues
Sort by recently updated
recently updated
newest added

Chapter 9 error in Sklearn "DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), for example using ravel(). y = column_or_1d(y, warn=True)"

[{"_id":"6327662aa49e0e1da50b1966","body":"That's because you are creating the prediction labels in the wrong way. You can follow the process from here https:\/\/github.com\/dipanjanS\/adv_nlp_workshop_odsc_europe22\/blob\/main\/02_NLP_Applications_Text_Classification_Deep_Learning_CNN_Models.ipynb and then pass the outputs to the label encoder. ","issue_id":1660133728929,"origin_id":1175574815,"user_origin_id":3448263,"create_time":1657061056,"update_time":1657061056,"id":1663526442083,"updated_at":"2022-09-18T18:40:42.083000Z","created_at":"2022-09-18T18:40:42.083000Z"}] comment

The code in Chapter 9 example on "Analyzing Wine Types" ```wtp_dnn_predictions = le.inverse_transform(wtp_dnn_ypred) ``` throws a warning, and then a fatal error. I don't know how to fix this yet....

Chapter 9 error Tensorflow AttributeError: 'Sequential' object has no attribute 'predict_class' because predict_class() changed to predict()

[{"_id":"63276630a49e0e1da50b1967","body":"Yes unfortunately TensorFlow has removed that function.\r\n\r\nYou can use the Model Evaluation code here and reuse the same in the other\r\nmodel\r\nhttps:\/\/github.com\/dipanjanS\/adv_nlp_workshop_odsc_europe22\/blob\/main\/02_NLP_Applications_Text_Classification_Deep_Learning_CNN_Models.ipynb\r\n\r\nHope this helps.\r\n\r\nOn Wed, Jul 6, 2022 at 4:01 AM Rich Lysakowski ***@***.***>\r\nwrote:\r\n\r\n> ------------------------------\r\n>\r\n> AttributeError Traceback (most recent call last)\r\n> Input In [41], in <cell line: 3>()\r\n> 1 # AFTER changing the code, the line runs without error:\r\n> ----> 3 wtp_dnn_ypred = wtp_dnn_model.predict_class(wtp_test_SX)\r\n> 4 wtp_dnn_ypred\r\n>\r\n> AttributeError: 'Sequential' object has no attribute 'predict_class'\r\n>\r\n> ######################\r\n>\r\n> I found a solution to this...\r\n>\r\n> Original CODE FAILED due to a change in Tensorflow 2.6 in May-June 2022\r\n>\r\n> Problem described here:\r\n>\r\n>\r\n> https:\/\/stackoverflow.com\/questions\/68836551\/keras-attributeerror-sequential-object-has-no-attribute-predict-classes\r\n>\r\n> wtp_dnn_ypred` = wtp_dnn_model.predict_classes(wtp_test_SX)\r\n>\r\n> This was changed to:\r\n>\r\n> wtp_dnn_ypred = wtp_dnn_model.predict(wtp_test_SX)\r\n>\r\n> \u2014\r\n> Reply to this email directly, view it on GitHub\r\n> <https:\/\/github.com\/dipanjanS\/practical-machine-learning-with-python\/issues\/32>,\r\n> or unsubscribe\r\n> <https:\/\/github.com\/notifications\/unsubscribe-auth\/AA2J3R46YRODO2STK234XN3VSSZVXANCNFSM52XVOIWA>\r\n> .\r\n> You are receiving this because you are subscribed to this thread.Message\r\n> ID: ***@***.***\r\n> com>\r\n>\r\n","issue_id":1660133728932,"origin_id":1175568936,"user_origin_id":3448263,"create_time":1657060597,"update_time":1657060990,"id":1663526448425,"updated_at":"2022-09-18T18:40:48.425000Z","created_at":"2022-09-18T18:40:48.425000Z"}] comment

--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) Input In [41], in () 1 # AFTER changing the code, the line runs without error: ----> 3 wtp_dnn_ypred = wtp_dnn_model.predict_class(wtp_test_SX) 4 wtp_dnn_ypred...

`"he'll've": "he he will have"` in the contractions file should be `"he'll've": "he will have"`

unable to install model_evaluation_utils

[{"_id":"632767720d68a95f041c0d70","body":"It's not a publicly available library, there is a `model_evaluation_utils.py` file which is imported in the code and used","issue_id":1660133728941,"origin_id":501069073,"user_origin_id":3448263,"create_time":1560297947,"update_time":1560297947,"id":1663526770643,"updated_at":"2022-09-18T18:46:10.642000Z","created_at":"2022-09-18T18:46:10.642000Z"},{"_id":"632767720d68a95f041c0d71","body":"thanks. I tried to import the file but i am getting this error:\r\nAttributeError: module 'model_evaluation_utils' has no attribute 'display_model_performance_metrics'","issue_id":1660133728941,"origin_id":501195419,"user_origin_id":11345816,"create_time":1560331881,"update_time":1560331881,"id":1663526770649,"updated_at":"2022-09-18T18:46:10.648000Z","created_at":"2022-09-18T18:46:10.648000Z"},{"_id":"632767720d68a95f041c0d72","body":"Could you please mention more details like which notebook, which folder \\ chapter and files you are using, and even show the code causing the error. It is difficult to debug it from just this message because the said function is already present in the file.","issue_id":1660133728941,"origin_id":501751397,"user_origin_id":3448263,"create_time":1560439500,"update_time":1560439500,"id":1663526770652,"updated_at":"2022-09-18T18:46:10.651000Z","created_at":"2022-09-18T18:46:10.651000Z"},{"_id":"632767720d68a95f041c0d74","body":"AttributeError: module 'model_evaluation_utils' has no attribute 'display_model_performance_metrics'\r\nthe above function is already present in the file but still i am getting that error.\r\nPlease help me to resolve this issue.\r\n\r\n","issue_id":1660133728941,"origin_id":602451452,"user_origin_id":62539391,"create_time":1584951953,"update_time":1584951953,"id":1663526770656,"updated_at":"2022-09-18T18:46:10.656000Z","created_at":"2022-09-18T18:46:10.656000Z"},{"_id":"632767720d68a95f041c0d75","body":"> thanks. I tried to import the file but i am getting this error:\r\n> AttributeError: module 'model_evaluation_utils' has no attribute 'display_model_performance_metrics'\r\n\r\nIs ur error resolved, if so please help me.","issue_id":1660133728941,"origin_id":602452607,"user_origin_id":62539391,"create_time":1584952116,"update_time":1584952116,"id":1663526770659,"updated_at":"2022-09-18T18:46:10.658000Z","created_at":"2022-09-18T18:46:10.658000Z"},{"_id":"632767720d68a95f041c0d77","body":"I am guessing that this is just a .py file that you have to run and use its functions. \r\n\r\nI used this code instead of importing the \"model_evaluation_utils\" and used the functions defined here directly instead:\r\nhttps:\/\/github.com\/dipanjanS\/practical-machine-learning-with-python\/blob\/master\/notebooks\/Ch05_Building_Tuning_and_Deploying_Models\/model_evaluation_utils.py\r\n\r\nThis solved my problem","issue_id":1660133728941,"origin_id":602924047,"user_origin_id":39736778,"create_time":1585008081,"update_time":1585008081,"id":1663526770663,"updated_at":"2022-09-18T18:46:10.663000Z","created_at":"2022-09-18T18:46:10.663000Z"},{"_id":"632767720d68a95f041c0d78","body":"> AttributeError: module 'model_evaluation_utils' has no attribute 'display_model_performance_metrics'\r\n> the above function is already present in the file but still i am getting that error.\r\n> Please help me to resolve this issue.\r\n\r\nThis is the function that you required from the model_evaluation_utils file:\r\n\r\n`def display_model_performance_metrics(true_labels, predicted_labels, classes=[1,0]):\r\n print('Model Performance metrics:')\r\n print('-'*30)\r\n get_metrics(true_labels=true_labels, predicted_labels=predicted_labels)\r\n print('\\nModel Classification report:')\r\n print('-'*30)\r\n display_classification_report(true_labels=true_labels, predicted_labels=predicted_labels, \r\n classes=classes)\r\n print('\\nPrediction Confusion Matrix:')\r\n print('-'*30)\r\n display_confusion_matrix(true_labels=true_labels, predicted_labels=predicted_labels, \r\n classes=classes)`","issue_id":1660133728941,"origin_id":602924855,"user_origin_id":39736778,"create_time":1585008233,"update_time":1585008233,"id":1663526770666,"updated_at":"2022-09-18T18:46:10.666000Z","created_at":"2022-09-18T18:46:10.666000Z"},{"_id":"632767720d68a95f041c0d79","body":"I am guessing that this is just a .py file that you have to run and use its functions.\r\nI used this code instead of importing the \"model_evaluation_utils\" and used the functions defined here directly instead:\r\nhttps:\/\/github.com\/dipanjanS\/practical-machine-learning-with-python\/blob\/master\/notebooks\/Ch05_Building_Tuning_and_Deploying_Models\/model_evaluation_utils.py \r\nThis solved my problem\r\n\r\nThank you so much....... @A5mad ","issue_id":1660133728941,"origin_id":603030562,"user_origin_id":62539391,"create_time":1585028918,"update_time":1585028918,"id":1663526770668,"updated_at":"2022-09-18T18:46:10.668000Z","created_at":"2022-09-18T18:46:10.668000Z"},{"_id":"6619c73b5b0d02dae609731a","body":"hello,\r\ni am a student,\r\ni have gone through your book- 1_Practical Machine Learning with Python_ A Problem-Solver\u2019s Guide to Building Real-World Intelligent Systems\r\ni am learning this chapter \r\nCHAPTER 9\r\nAnalyzing Wine Types and Quality\r\n\r\ni got stuck at Predictive Modeling task\r\nat this code\r\nimport model_evaluation_utils as meu\r\n![Screenshot 2023-03-08 011605](https:\/\/user-images.githubusercontent.com\/127230917\/223594208-ddc9fc47-04c8-46b0-9e4c-9b6e5d15d438.png) \r\n\r\nits looks like you have created this library, if possible will u share with us.\r\n\r\nTHANK YOU.\r\nMOHAMMED AZMATH\r\n","issue_id":1660133728941,"origin_id":1459117836,"user_origin_id":127230917,"create_time":1678238348,"update_time":1678277444,"id":1712965435066,"updated_at":"2024-04-12T23:43:55.065000Z","created_at":"2024-04-12T23:43:55.065000Z"}] comment

Hi, I am trying to use your model evaluation package in google colab and I am getting the error as below: !pip install model_evaluation_utils Collecting model_evaluation_utils ERROR: Could not find...

Error in Accessing Layers of Word Embedding model

[{"_id":"63276876a6ecce368d5cccb2","body":"Thanks","issue_id":1660133728944,"origin_id":819744519,"user_origin_id":44837753,"create_time":1618425428,"update_time":1618425428,"id":1663527030137,"updated_at":"2022-09-18T18:50:30.136000Z","created_at":"2022-09-18T18:50:30.136000Z"}] comment

In [this code](https://github.com/dipanjanS/practical-machine-learning-with-python/blob/master/bonus%20content/feature%20engineering%20text%20data/Feature%20Engineering%20Text%20Data%20-%20Advanced%20Deep%20Learning%20Strategies.ipynb), in the "Get word embeddings" section of the "Skip-gram model", the code is as follows: `merge_layer = model.layers[0]` `word_model = merge_layer.layers[0]` `word_embed_layer = word_model.layers[0]` `weights = word_embed_layer.get_weights()[0][1:]`...

Hello, I hope you're well. I like very much your handbook and real-world examples. My issue is the following concerning the **Chapter 11 - notebook_gold_forecast_arima.ipynb** : in the paragraph 24th...

merge function is not working for Skipgram code

[{"_id":"63276967a49e0e1da50b19d0","body":"sorry, didn't mention earlier, it was the merge part that is not working.","issue_id":1660133728951,"origin_id":457401258,"user_origin_id":24736641,"create_time":1548373525,"update_time":1548373525,"id":1663527271518,"updated_at":"2022-09-18T18:54:31.517000Z","created_at":"2022-09-18T18:54:31.517000Z"},{"_id":"63276967a49e0e1da50b19d1","body":"Thanks, yes we are aware of this happening due to the deprecation of the `Merge` API, I will be pushing this change soon in my 2nd edition of the text analytics book and once that is out, will be replacing the code here also!","issue_id":1660133728951,"origin_id":457567667,"user_origin_id":3448263,"create_time":1548421755,"update_time":1548421755,"id":1663527271521,"updated_at":"2022-09-18T18:54:31.521000Z","created_at":"2022-09-18T18:54:31.521000Z"},{"_id":"63276967a49e0e1da50b19d3","body":"Hi, you can replace Merge by Concatenate\r\nmodel.add(Merge([word_model, context_model], mode=\"dot\"))\r\n-->\r\nmodel.add(Concatenate([word_model, context_model]))","issue_id":1660133728951,"origin_id":719863523,"user_origin_id":5006333,"create_time":1604107180,"update_time":1604107180,"id":1663527271526,"updated_at":"2022-09-18T18:54:31.526000Z","created_at":"2022-09-18T18:54:31.526000Z"}] comment

in the below code with keras latest version, its not working. ``` from keras.layers import Merge from keras.layers.core import Dense, Reshape from keras.layers.embeddings import Embedding from keras.models import Sequential #...

2 print("num of required transactions = ", int(input_assoc_rules.shape[0]*support)) 3 num_trans = input_assoc_rules.shape[0]*support ----> 4 itemsets = dict(frequent_itemsets(data_tran_uk_en, support)) NameError: name 'frequent_itemsets' is not defined