Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Logistic Regression Class for binary classification #5

Open
dabasajay opened this issue Jun 23, 2019 · 2 comments
Open

Implement Logistic Regression Class for binary classification #5

dabasajay opened this issue Jun 23, 2019 · 2 comments

Comments

@dabasajay
Copy link
Collaborator

Implement the LogisticRegression Class for binary classification problems.

LogisticRegression class should have these methods:

  • .fit(X,y) :- it takes in features(X) and targets(y) and trains the model.
  • .predict(X) :- it takes features(X) as input and outputs the predicted targets/labels(y)
  • .predict_proba(X) :- it takes features(X) as input and outputs the predicted probabilities of targets/labels(y)

Note:

  • .predict() can internally call .predict_proba() and then change probabilities to labels based on threshold(default to 0.5)

Test your model on IRIS dataset using 2 classes(instead of 3 classes of IRIS) available in the library and check how well it performs.
Example code

from learnemall.datasets import iris
from learnemall.linear import LogisticRegression
model = LogisticRegression()
X,y = iris.load_dataset()
# Take 2 classes only
X = X [ : , :-2]
y = (y!=0)*1
# train the model
model.fit(X,y)
# predict using model
y_pred = model.predict(X)
# Evaluate
print((y_pred == y).mean())
@JARVVVIS
Copy link
Contributor

I want to claim this issue

@Ayush789
Copy link
Member

I want to claim this issue

Issue Assigned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants