3
$\begingroup$

I am extremely new to this data science world so bear with me if my question is not very clear, I'd be glad to clarify. What I am looking for is simple: train a program with a set of values (5 ordered integer inputs, 1 boolean output). Then I would give it 5 inputs where the outcome is not known, and it has to tell me the outcome.

$\endgroup$
  • $\begingroup$ It sounds like a straightforward classification problem. If you tell us more about the nature of the data we can be more specific. $\endgroup$ – Emre Jun 8 '17 at 0:24
  • 1
    $\begingroup$ Prediction engine for mixed martial arts. Every bout has two fighters, and fighters have a set of stats (Reach, takedown attempts, takedown accuracy, striking attempts, striking accuracy, etc.). The engine would learn from about 20 years worth of fights, comparing the differentials of these stats between the two fighters, and then register the result (the winner). Obviously there are a lot more variables that should be taken into consideration, but this is what I will be exercising with as an introduction to machine-learning. $\endgroup$ – Wassim H Jun 8 '17 at 1:19
  • $\begingroup$ Study TrueSkill (implementation) $\endgroup$ – Emre Jun 8 '17 at 2:21
  • $\begingroup$ Will do, thank you for the recommendation. Do you think the NaiveBayes algorithm will work for what I'm trying to achieve ? The example from this library seems to be relevant: accord-framework.net/docs/html/… $\endgroup$ – Wassim H Jun 8 '17 at 3:07
  • $\begingroup$ It's the right type of algorithm so it's worth a try. $\endgroup$ – Emre Jun 8 '17 at 3:13
1
$\begingroup$

It is a basic classification model. Our focus is to train the model using training dataset and evaluate its performance with the test set.

In your case, assume you have 10 numbers as input and a binary output. Consider random 8 entries as your training data and train it with any classification algorithm using R/Python. Then test it on the remaining entries which acts as a test data.

Since it is associated with classification we need to consider performance metrics like accuracy, precision and recall based on the labeled feature.

For more details on classification try here

| improve this answer | |
$\endgroup$
0
$\begingroup$

scikit-learn is a powerful and a very very simple ML library for Python.

Your doubt is about a Classification Problem, where you're going to predict a class (True or False) given some input data.

There are many classifiers that you can use.

In this example I've used Logistic Regression

from sklearn.linear_model import LogisticRegression

# Input data
data = [[1.0, 2.0, 3.0, 4.0, 5.0], [6.0, 7.0, 8.0, 9.0, 10.0]]

# Target values for input data
target = [True, False]

# Define the model (default parameters)
model = LogisticRegression(C=1.0, penalty='l1', tol=1e-6)

# Train the model
model.fit(data, target)

# Once the model is trained, we make a prediction
model.predict([[1.0, 2.0, 3.0, 4.0, 5.0]])

If you execute this code, the prediction for that data is False

| improve this answer | |
$\endgroup$
  • 2
    $\begingroup$ shouldn't it return True? First element of the target array as match to first element of data array? $\endgroup$ – Pieter21 Sep 6 '17 at 13:02
  • $\begingroup$ It's a very simple example, so please don't take it too seriously. See that there're only 2 rows for training the model, and it must not fit with 100% of accuracy. $\endgroup$ – japmelian Sep 6 '17 at 13:20
  • $\begingroup$ Decreasing the regularisation (by increasing C to e.g. 10), or changing weight penalty type to 'l2' should make the predictions work as expected. Or just using the default model = LogisticRegression() - that might be better in this answer, as including regularisation terms without explaining them makes the example more complicated and the goal is a simple example . . . (also your comment # (default parameters) is not correct, the defaults are (C=1.0, penalty='l2', tol=1e-4) $\endgroup$ – Neil Slater Sep 7 '17 at 9:59
0
$\begingroup$

It seems overkill, but I gonna tell you how to get strict math dependency from your data:

  1. same sets of inputs should be converted to single set and rate instead of bool, where true increments rate and false decrements the rate for same sets of values.
  2. input vars set should be converted to system of equations: $v_1=a, v_2=b ... $ where $a,b,c,d,e$ are particular inputs set. And one more var for rate.
  3. simultaneous equations may be converted to single equation formed by summing it squares: $(v1-a)^2+(v2-b)^2+(v3-c)^2...=0$
  4. the equation may be used if you insert new set of vars values in equation and see which rate will outcome.
  5. find the equation that gives best fit to your set of data.

If you have aggressive calculation abilities then you may want to proceed to next level of precision:

  1. Do steps 1-3 of the previous sequence.
  2. Different sets are non-simultaneous equation of the system you need. Non-simulteneous system may be converted to single equation using multiplication. You'l have big product of all your data like $((v1-a1)^2+(v2-b1)^2+(v3-c1)^2...)((v1-a2)^2+(v2-b2)^2+(v3-c2)^2...)((v1-a3)^2+(v2-b3)^2+(v3-c3)^2...)...=0$
  3. Use the system and OpenCL or IBM XL C++ compiler OpenMP extension offload to Nvidia GPUs feature to simulteneously calculate members of the product that have all information of flight results.

Similar approach is used in this extrapolator implementation and its math framework.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.