GithubHelp home page GithubHelp logo

santara / ml-mooc-nptel Goto Github PK

View Code? Open in Web Editor NEW
192.0 36.0 235.0 11.58 MB

This repository contains the Tutorials for the NPTEL MOOC on Machine Learning.

License: GNU General Public License v3.0

Jupyter Notebook 100.00%

ml-mooc-nptel's Issues

ValueError: Masked arrays must be 1-D

In Logistic Regression section of the code

Prepare data code cell

for the following line the below mentioned error occurs
plt.scatter(X_class0[:,0], X_class0[:,1],color='red')


ValueError Traceback (most recent call last)
in ()
27 Y_class1 = np.ones((X_class1.shape[0]),dtype=np.int)
28
---> 29 plt.scatter(X_class0[:,0], X_class0[:,1],color='red')
30 plt.scatter(X_class1[:,0], X_class1[:,1],color='blue')
31 plt.xlabel('sepal length')

~/anaconda3/envs/mlai/lib/python3.6/site-packages/matplotlib/pyplot.py in scatter(x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, hold, data, **kwargs)
3468 vmin=vmin, vmax=vmax, alpha=alpha,
3469 linewidths=linewidths, verts=verts,
-> 3470 edgecolors=edgecolors, data=data, **kwargs)
3471 finally:
3472 ax._hold = washold

~/anaconda3/envs/mlai/lib/python3.6/site-packages/matplotlib/init.py in inner(ax, *args, **kwargs)
1853 "the Matplotlib list!)" % (label_namer, func.name),
1854 RuntimeWarning, stacklevel=2)
-> 1855 return func(ax, *args, **kwargs)
1856
1857 inner.doc = _add_data_doc(inner.doc,

~/anaconda3/envs/mlai/lib/python3.6/site-packages/matplotlib/axes/_axes.py in scatter(self, x, y, s, c, marker, cmap, norm, vmin, vmax, alpha, linewidths, verts, edgecolors, **kwargs)
4285 x, y, s, c, colors, edgecolors, linewidths =
4286 cbook.delete_masked_points(
-> 4287 x, y, s, c, colors, edgecolors, linewidths)
4288
4289 scales = s # Renamed for readability below.

~/anaconda3/envs/mlai/lib/python3.6/site-packages/matplotlib/cbook/init.py in delete_masked_points(*args)
1655 if isinstance(x, np.ma.MaskedArray):
1656 if x.ndim > 1:
-> 1657 raise ValueError("Masked arrays must be 1-D")
1658 else:
1659 x = np.asarray(x)

ValueError: Masked arrays must be 1-D

In tutorial1

plt.scatter(X_class1[:,0], X_class1[:,1],color='blue')

should be
plt.scatter([X_class1[:,0]], [X_class1[:,1]],color='blue')

ans same for other red color

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.