Python Machine Learning Functions

Viewed 1911

Is there functionality in Machine Learning (using Python) that I could use to feed it a group of inputs, tell it what the end product should be, then have the code figure out what function it should use in order to reach the end product?

Thanks.

8 Answers

If you have just started learning ML then you should first get the ideas about different scientific libraries which Python provides. Most important thing is that you have to start with basic understanding of machine learning modelling from various online material available or by doing ML course.

FYI.. there is no such functionality available in python which gives you information about the model which is perfect for a particular set of data. It solely depends on how much analytical you are to choose a good model for your dataset by checking different statistical/model parameters.

What you are talking about is Supervised Learning. There is no direct way that the machine will automatically decide the model by itself. But yes there are ways by which you can compare different models based on there performance.

But first, if you really want to excel in ML, first you should understand your dataset to guess which model you should use. For example, Linear Regression is used to estimate real values (cost of any article, salary, total sales etc.) based on continuous variable(s). Logistic Regression is used to estimate discrete values ( Binary values like 0/1, yes/no, true/false ) based on given set of independent variable(s).

If you are done with selecting the right model, then yes, there are some ways by which you can get the better performance out of your model by parameter tuning. One way is by using XGBoost(https://xgboost.readthedocs.io/en/latest/index.html )

Since you are new, it would be good to start with the basics. For starters, go thought this image: enter image description here

The ML process follows certain steps. First is to take in the data > pre-process (bring the data into right format for editing/creating charts/ improve readability) > then understand what you are looking from the data > whether its classification or regression problem> divide the data into 2 parts i.e. training and test data > training data has all the input as well outputs.What the training data does is, it helps the ML algorithms to weigh the important feature's values.The test data does not have the outputs provided, its task is to use the training from the train data to predict the outcome. >once you understand the desired outcome, you can browse different ML algorithms (libraries provide all the implementation! ) appropriate for your problem > or apply all the algorithms to the dataset and find the accuracy> opt for the one with higher accuracy along with a good bias-variance trade-off.

Coming back to your question of have the code figure out the right function. No it does not work that way, we need to apply different functions(ml libraries) to find the best one. But its super easy and fun! You can also check out the ML course on Coursera to have a hands-on ML if this all appears to you greek and latin.

From your question, I garner that you have a result and are trying to find the optimal algorithm to reach there. Unfortunately, as far as I'm aware, you have to compare the different algorithms in itself to understand which one has better performance. However if you only wish to obtain a suitable algorithm for your use-case but are unsure what broad classification to start looking for an algorithm in, then I'd suggest you read up on the different types of machine learning (classification/regression) and then establish relations between your use case and how the algorithm performs its tasks. With that as a fundamental, you can fine tune your search.

To summarize the answer to your question, I would suggest you before going into any technical details, try to simplify your problem you are tackling. I have seen many data scientists making mistake on putting too much effort to convince themselves that Machine Learning is an answer to their problems.

Here I try to answer to your question in details:

Firstly, you need to ask yourself (and your company/organization) what you want to achieve out of Machine Learning. What result are you looking for?

There may be two types of questions:

A. Technical Questions:

  1. Can ML be a solution to the problem?
  2. Do we have THE data?

    • Do we have all necessary related data?
    • Is there enough amount of data to develop algorithm?
    • Is data collected in the right way?
    • Is data saved in the right format?
    • Is the access to information guaranteed?
  3. Can we satisfy all the Business Questions by means of ML?

B. Business Questions:

  1. What are the organization's business goals?
    • To reduce cost and increase revenue? To increase efficiencies?
    • To avoid risks? To improve quality?
  2. Is it worth to develop ML?
    • In short term? In long term?
    • What are the success metrics?
    • Can we handle the risk if the project is unsuccessful?
  3. Do we have the resources?
    • Do we have enough time to develop ML?
    • Do we have a right talented team?

There could be many more questions depending on situation. If you are working on your own project or research, you need to be able to somehow answer to all of these questions, precisely.

After you have all of the answers, you are ready to make a decision to go with Machine Learning development or not. From my own experience, theoretically, there are not many things in our world that cannot be sorted out by means of Machine Learning. The problem comes up when we are looking forward into it practically, especially regarding available data.

Generally, depending on the data you have, you can look into different styles of ML. Generally, if you have labeled data (consider it as data you have a good understanding of), then probably supervised ML is good for you. On the other hand, unlabeled data usually requires unsupervised ML. If your data is collected from a virtual test, game, or perhaps simulation, you can have a look at reinforcement. If you have big data (read it as 'huge data') and you only care about output (rather than algorithm itself), deep learning is probably a right choice.

After choosing the style of your ML, then you need to make sure what type of output you are looking for. For example do you want True/False output, or do you want to find how similar or close to each other your data points are? Depending on the required type of output, you can choose the type of ML.

Finally, you can get into more details with choosing proper algorithm. This should be done explicitly as it depends on many many factors, from data type and amount of data to output type. So as you can see, there could not be a simple peace of code to show you the best possible algorithm.

Maybe you can start by looking at scikitlearn algorithm cheat sheet

enter image description here

I hope you could find my answer helpful.

Related