packtpublishing / interpretable-machine-learning-with-python Goto Github PK
View Code? Open in Web Editor NEWInterpretable Machine Learning with Python, published by Packt
License: MIT License
Interpretable Machine Learning with Python, published by Packt
License: MIT License
No module named 'machine_learning_datasets'
how to install machine_learning_datasets, thank you very much
On chapter 03 I have following problem. Scikit-learn version I have installed is 0.22.2.post1
I printed out model name where it stops (logistic regression)
AttributeError Traceback (most recent call last)
in
1 for model_name in class_models.keys():
2 print(model_name)
----> 3 fitted_model = class_models[model_name]['model'].fit(X_train, y_train_class)
4 y_train_pred = fitted_model.predict(X_train.values)
5 if model_name == 'ridge':
~\miniconda3\envs\tensorflow\lib\site-packages\sklearn\linear_model_logistic.py in fit(self, X, y, sample_weight)
1589 else:
1590 prefer = 'processes'
-> 1591 fold_coefs_ = Parallel(n_jobs=self.n_jobs, verbose=self.verbose,
1592 **joblib_parallel_args(prefer=prefer))(
1593 path_func(X, y, pos_class=class, Cs=[C_],
~\miniconda3\envs\tensorflow\lib\site-packages\joblib\parallel.py in call(self, iterable)
1039 # remaining jobs.
1040 self._iterating = False
-> 1041 if self.dispatch_one_batch(iterator):
1042 self._iterating = self._original_iterator is not None
1043
~\miniconda3\envs\tensorflow\lib\site-packages\joblib\parallel.py in dispatch_one_batch(self, iterator)
857 return False
858 else:
--> 859 self._dispatch(tasks)
860 return True
861
~\miniconda3\envs\tensorflow\lib\site-packages\joblib\parallel.py in _dispatch(self, batch)
775 with self._lock:
776 job_idx = len(self._jobs)
--> 777 job = self._backend.apply_async(batch, callback=cb)
778 # A job can complete so quickly than its callback is
779 # called before we get here, causing self._jobs to
~\miniconda3\envs\tensorflow\lib\site-packages\joblib_parallel_backends.py in apply_async(self, func, callback)
206 def apply_async(self, func, callback=None):
207 """Schedule a func to be run"""
--> 208 result = ImmediateResult(func)
209 if callback:
210 callback(result)
~\miniconda3\envs\tensorflow\lib\site-packages\joblib_parallel_backends.py in init(self, batch)
570 # Don't delay the application, to avoid keeping the input
571 # arguments in memory
--> 572 self.results = batch()
573
574 def get(self):
~\miniconda3\envs\tensorflow\lib\site-packages\joblib\parallel.py in call(self)
260 # change the default number of processes to -1
261 with parallel_backend(self._backend, n_jobs=self._n_jobs):
--> 262 return [func(*args, **kwargs)
263 for func, args, kwargs in self.items]
264
~\miniconda3\envs\tensorflow\lib\site-packages\joblib\parallel.py in (.0)
260 # change the default number of processes to -1
261 with parallel_backend(self._backend, n_jobs=self._n_jobs):
--> 262 return [func(*args, **kwargs)
263 for func, args, kwargs in self.items]
264
~\miniconda3\envs\tensorflow\lib\site-packages\sklearn\linear_model_logistic.py in _logistic_regression_path(X, y, pos_class, Cs, fit_intercept, max_iter, tol, verbose, solver, coef, class_weight, dual, penalty, intercept_scaling, multi_class, random_state, check_input, max_squared_sum, sample_weight, l1_ratio)
936 options={"iprint": iprint, "gtol": tol, "maxiter": max_iter}
937 )
--> 938 n_iter_i = _check_optimize_result(
939 solver, opt_res, max_iter,
940 extra_warning_msg=_LOGISTIC_SOLVER_CONVERGENCE_MSG)
~\miniconda3\envs\tensorflow\lib\site-packages\sklearn\utils\optimize.py in _check_optimize_result(solver, result, max_iter, extra_warning_msg)
241 " https://scikit-learn.org/stable/modules/"
242 "preprocessing.html"
--> 243 ).format(solver, result.status, result.message.decode("latin1"))
244 if extra_warning_msg is not None:
245 warning_msg += "\n" + extra_warning_msg
AttributeError: 'str' object has no attribute 'decode'`
ROC-AUC curve that was explained on page 81 by plotting the proportion of true
positive rate (Recall) on the x-axis and the false positive rate on the y-axis should be
plotting the proportion of the true positive rate (Recall) on the y-axis and the false positive rate on the x-axis.
Thought it may be helpful/convenient to have a link to the license in the readme
Try to create environment with python version 3.6, 3.7, 3.8 and 3.9 and requirements.txt
pip install -r requirements.txt
but none of them are successful. The reason is pip can resolve dependencies conflicts between the packages.
try to ignore install the environment with option '--no-deps', installation could be completed but could run any example due to lack of dependencies.
Is there any method to set up the environment?
Bought book. Cloned this git. First cell after importing libraries is broken.
url = 'http://wiki.stat.ucla.edu/socr/index.php/SOCR_Data_Dinov_020108_HeightsWeights' page = requests.get(url)
Hi,
On following part of book I get error down below
plt.rcParams.update({'font.size': 14}) fig, axarr = plt.subplots(2, 2, figsize=(12,8), sharex=True, sharey=False) mldatasets.create_decision_plot(X_test, y_test, log_result, [5, 1], ['ap_hi [mmHg]', 'age [years]'], X_highlight, filler_feature_values, filler_feature_ranges, ax=axarr.flat[0]) mldatasets.create_decision_plot(X_test, y_test, log_result, [5, 7], ['ap_hi [mmHg]', 'cholesterol [1-3]'], X_highlight, filler_feature_values, filler_feature_ranges, ax=axarr.flat[1]) mldatasets.create_decision_plot(X_test, y_test, log_result, [5, 6], ['ap_hi [mmHg]', 'ap_lo [mmHg]'], X_highlight, filler_feature_values, filler_feature_ranges, ax=axarr.flat[2]) mldatasets.create_decision_plot(X_test, y_test, log_result, [5, 4], ['ap_hi [mmHg]', 'weight [kg]'], X_highlight, filler_feature_values, filler_feature_ranges, ax=axarr.flat[3]) plt.subplots_adjust(top = 1, bottom=0, hspace=0.2, wspace=0.2) plt.show()
TypeError Traceback (most recent call last)
in
1 plt.rcParams.update({'font.size': 14})
2 fig, axarr = plt.subplots(2, 2, figsize=(12,8), sharex=True, sharey=False)
----> 3 mldatasets.create_decision_plot(X_test, y_test, log_result, [5, 1], ['ap_hi [mmHg]', 'age [years]'],
4 X_highlight, filler_feature_values, filler_feature_ranges, ax=axarr.flat[0])
5 mldatasets.create_decision_plot(X_test, y_test, log_result, [5, 7], ['ap_hi [mmHg]', 'cholesterol [1-3]'],
c:\users***\miniconda3\lib\site-packages\machine_learning_datasets\common.py in create_decision_plot(X, y, model, feature_index, feature_names, X_highlight, filler_feature_values, filler_feature_ranges, ax)
399 filler_values = dict((k, filler_feature_values[k]) for k in filler_feature_values.keys() if k not in feature_index)
400 filler_ranges = dict((k, filler_feature_ranges[k]) for k in filler_feature_ranges.keys() if k not in feature_index)
--> 401 ax = plot_decision_regions(sm.add_constant(X).to_numpy(), y.to_numpy(), clf=model,
402 feature_index=feature_index,
403 X_highlight=X_highlight,
c:\users***\miniconda3\lib\site-packages\mlxtend\plotting\decision_regions.py in plot_decision_regions(X, y, clf, feature_index, filler_feature_values, filler_feature_ranges, ax, X_highlight, res, legend, hide_spines, markers, colors, scatter_kwargs, contourf_kwargs, scatter_highlight_kwargs)
242 antialiased=True)
243
--> 244 ax.axis(xmin=xx.min(), xmax=xx.max(), y_min=yy.min(), y_max=yy.max())
245
246 # Scatter training data samples
c:\users***\miniconda3\lib\site-packages\matplotlib\axes_base.py in axis(self, emit, *args, **kwargs)
1933 self.set_ylim(ymin, ymax, emit=emit, auto=yauto)
1934 if kwargs:
-> 1935 raise TypeError(f"axis() got an unexpected keyword argument "
1936 f"'{next(iter(kwargs))}'")
1937 return (*self.get_xlim(), *self.get_ylim())
TypeError: axis() got an unexpected keyword argument 'y_min'
`
While trying to pip install machine-learning-datasets I got the following error:
ERROR: Cannot uninstall 'llvmlite'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
I tried uninstalling and reinstalling llvmlite but to no avail...
please advise, or can I just forget about machine-learning-datasets
Chapter 2 is failing because I can't install CVAE nor Rulefit. I tried to drop the install of Tensorflow (currently 2.12.0) so that I can install CVAE (error says it requires TF version <2 >=1. When I tried to drop TF it says that it needs Tensorboard to be dropped which requires Python version to be dropped to > 2.7 < 2.8.
This seems awfully outdated. I feel myself going down rabbit holes in order to get this working. Not sure how I'm expected to make it through this book if the code for the book isn't at all maintained.
Please update or add instructions for how to get dependencies installed. I am currently working with conda version 23.11.0 and Python 3.11.5
Thank you
it seems like the original dataset has changed. Therefore when we follow the steps and try to index for the values of interest (idx1 = 5231, idx2 = 2726, idx3 = 10127), only index 10127 is returned, and even then it has different values then in the book/github notebook
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.