How can I do ordinal regression using the mord module in python?

Fate

I am trying to predict a label based on some features and I have some training data.

Searching for ordinal regression in python, I found http://pythonhosted.org/mord/ but I could not figure out how to use it.

It would be great if someone has an example code to demonstrate how to use this module. Here are the classes in the mord module:

>>>import mord    
>>>dir(mord)
    ['LAD',
 'LogisticAT',
 'LogisticIT',
 'LogisticSE',
 'OrdinalRidge',
 '__builtins__',
 '__doc__',
 '__file__',
 '__name__',
 '__package__',
 '__path__',
 '__version__',
 'base',
 'check_X_y',
 'grad_margin',
 'linear_model',
 'log_loss',
 'metrics',
 'np',
 'obj_margin',
 'optimize',
 'propodds_loss',
 'regression_based',
 'sigmoid',
 'svm',
 'threshold_based',
 'threshold_fit',
 'threshold_predict',
 'utils']
Manoj Reddy

I believe it follows the API of Scikit-learn. So here is an example:

import numpy as np
import mord as m
c = m.LogisticIT() #Default parameters: alpha=1.0, verbose=0, maxiter=10000
c.fit(np.array([[0,0,0,1],[0,1,0,0],[1,0,0,0]]), np.array([1,2,3]))
c.predict(np.array([0,0,0,1]))
c.predict(np.array([0,1,0,0]))
c.predict(np.array([1,0,0,0]))

The output will be as follows:

array([1])

array([2])

array([3])

Hope it was helpful

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How can I do ordinal regression using the mord module in python?

From Dev

How do I get the value of a global variable in a dll which is described by an ordinal not a name using ctypes in Python?

From Dev

how can I do a maximum likelihood regression using scipy.optimize.minimize

From Dev

How do I send files in an email by using the Python email module?

From Dev

How do I plot the decision boundary of a regression using matplotlib?

From Dev

how do I find the actual logistic regression model in python?

From Dev

How to do 2SLS IV regression using statsmodels python?

From Dev

How do I find the location of Python module sources while I can not import it?

From Dev

How can I build a Python module in Hy?

From Dev

How can I find the function of a python module?

From Dev

How do I install a Python module?

From Java

How do I unload (reload) a Python module?

From Dev

How do I install the python pymorph module?

From Dev

How can I load a module into another module using Elixir language?

From Dev

How do I know if I can trust a CPAN module

From Dev

How can I split an ordinal axis in d3?

From Dev

How can I get a Python program to kill itself using a command run through the module sys?

From Dev

How can I list video resolutions in youtube-dl while using it as a python module?

From Dev

How can I replace patterns using re module in python3

From Dev

How can I extract redirected url with Python without using requests module and via xpath?

From Dev

Using the python sh module, how can I show the output of a command as it's happening?

From Dev

How do I access a module from a package using Python's zipimport?

From Dev

How do I execute a bash function defined in .profile using python subprocess module?

From Dev

How do I do image plots in the gnuplot module for python?

From Dev

How do I do image plots in the gnuplot module for python?

From Dev

How do I regression test serial comms?

From Dev

Concurrency with subprocess module. How can I do this?

From Dev

How to turn just one row of a matrix into a vector so I can do a linear regression on it?

From Dev

Are there any machine learning regression algorithms that can train on ordinal data?

Related Related

  1. 1

    How can I do ordinal regression using the mord module in python?

  2. 2

    How do I get the value of a global variable in a dll which is described by an ordinal not a name using ctypes in Python?

  3. 3

    how can I do a maximum likelihood regression using scipy.optimize.minimize

  4. 4

    How do I send files in an email by using the Python email module?

  5. 5

    How do I plot the decision boundary of a regression using matplotlib?

  6. 6

    how do I find the actual logistic regression model in python?

  7. 7

    How to do 2SLS IV regression using statsmodels python?

  8. 8

    How do I find the location of Python module sources while I can not import it?

  9. 9

    How can I build a Python module in Hy?

  10. 10

    How can I find the function of a python module?

  11. 11

    How do I install a Python module?

  12. 12

    How do I unload (reload) a Python module?

  13. 13

    How do I install the python pymorph module?

  14. 14

    How can I load a module into another module using Elixir language?

  15. 15

    How do I know if I can trust a CPAN module

  16. 16

    How can I split an ordinal axis in d3?

  17. 17

    How can I get a Python program to kill itself using a command run through the module sys?

  18. 18

    How can I list video resolutions in youtube-dl while using it as a python module?

  19. 19

    How can I replace patterns using re module in python3

  20. 20

    How can I extract redirected url with Python without using requests module and via xpath?

  21. 21

    Using the python sh module, how can I show the output of a command as it's happening?

  22. 22

    How do I access a module from a package using Python's zipimport?

  23. 23

    How do I execute a bash function defined in .profile using python subprocess module?

  24. 24

    How do I do image plots in the gnuplot module for python?

  25. 25

    How do I do image plots in the gnuplot module for python?

  26. 26

    How do I regression test serial comms?

  27. 27

    Concurrency with subprocess module. How can I do this?

  28. 28

    How to turn just one row of a matrix into a vector so I can do a linear regression on it?

  29. 29

    Are there any machine learning regression algorithms that can train on ordinal data?

HotTag

Archive