2

Am trying to solve the question:

A person might or might not like steaks, but that statistically depends on the person's age, ethnicity, gender, etc. A steak loving person might like their steaks from 0% cooked to 100% cooked, and seasoned with an arbitrary amount of salt. All these also depends on the person's age, ethnicity, gender, etc.

I want ML to predict the following:

Given a person's age, ethnicity, gender, etc, whether this person will like steaks or not. And if they like steaks, how they want their steaks to be cooked, and how much salt they will like to put on their steak.

I realize I can break this problem down into two neural networks, one binary classification and one multidimensional regression.

The first network will answer if the person likes steaks or not. If the person doesn't like steaks at all, there is no point generating outputs for the second network. But if the answer is yes, I can feed the subset of the dataset to the second network, then it will answer the whats.

However, what I don't understand is:

  1. Is it possible to chain the two networks together to form a single network? In a sense the output contains a Yes/No answer plus the answers for the regression network.

  2. If answer is yes, is it faster than running two separate networks considering the dataset to the second network might be smaller?

  3. Again, if answer is yes, how do I go about to implement this? Using 2 hidden layers with different loss functions? How many nodes for each layer? What is the activation function for each layer?

Rex5
  • 771
  • 9
  • 23
jahithber
  • 99
  • 8

3 Answers3

0

I haven't tried that myself yet, but you can try and let us know if it is going to work.

As meat can cooked from 0% to 100% (although not sure who would eat steak raw) but I would use regression to estimate steak with from -1 to 100, where -1 means does not like steak at all and all other numbers how much they want it cooked

asmgx
  • 7,328
  • 15
  • 82
  • 143
0

To answer to you questions:

  1. You should better use a pipeline in your case, with two algorithms : a binary classification algorithm first, and then a prediction algorithm. Splitting a problem into two distinct parts, when possible, is good practice, and provide better results.

Several points to mark here :

  • First of all, neural networks do NOT work for every machine learning problem. Here for example you should better use other algorithms.
  • For the binary classification (i.e. like or does not like steaks), I would not use neural networks but rather SVM or Logistic Regression (SVM is good for binary classification).
  • For the second part, you need to find values (i.e. how much salt people use, what percentage of cooking they prefer), so you should use a prediction algorithm, and not neural network, which is a classification one. Try to apply Linear Regression here.

For more information see the ML course on Coursera here, see Week5 and Week9.

Catalina Chircu
  • 1,506
  • 2
  • 8
  • 19
  • I think whether to use neural network depends on the dataset right? For example a dataset of age vs doneness level can be like the following: lots old folks like to have their steak well-done, and lots young folks like to have their steak rare. But then half of the middle age group like their steak rare and half of them like their steak well done. However, say for example, women in general like their steak more done than rare regardless of the age. This becomes a non-linear function, so not sure if linear regression will work for it. – jahithber Sep 13 '19 at 10:22
  • I understand what you say. But in fact, what you mention (age, gender, etc. ) are features, and if I understand well, your dataset is in a matrix, with features on columns and samples on rows, is it right ? Generally speaking, linearity / non-linearity does not concern the dataset or the features, but the algorithm and the way the dataset is transformed by it into a model. You mention features but they can be parsed both in a linear and in a non linear way. – Catalina Chircu Sep 13 '19 at 12:22
  • If you want to do a learning model in one step you will have missing data for the samples which do not like steak, and you will have to handle missing data and thus complicate your problem. On the other hand, using or not a NN does not depend only on the dataset but on what you want to do with it. Here you have a binary classification problem first and the best, generally recognized solution for that is SVM. – Catalina Chircu Sep 13 '19 at 12:25
  • The interesting thing here is that, what is missing is not the training data, it is the resulted labels. This means the full inputs are there. And the outputs with missing data can always be represented with some constant. – jahithber Sep 13 '19 at 19:42
  • I updated my answer with some references. As I said, you should better use a pipeline. I see you wish to do it in one step at any rate. Do it if you insist but it is not very good practice in your case. In that case, be careful that your constant be not ambiguous with another one in the dataset. Good luck! – Catalina Chircu Sep 14 '19 at 03:35
0

Hmmm, Interesting problem.

This is not a two classification + regression problem, it is a classification + optimisation model.

You need to build a model which will be able to predict if he likes the steak or not. Then you will try to maximum the probability of he liking steak by using the above machine learning as function you by tuning variables(cooking level, spice etc). This can be a generic brute force or a proper optimisation problem.

  • Sorry I'm not following. I'm pretty new to machine learning. Only started a few days ago. What's the difference between regression vs optimization? – jahithber Sep 13 '19 at 10:26