How to pass inputs (interactively) to a model?
$begingroup$
Let me give you a high-level design (blueprint) of my model.
Input data::
CATEGORY SERVICE TITLE DEPARTMENT
apple fruits i love eating fruits. fruitshop
mango fruits mangoes are yellow in color. fruitshop
cycle vehicle that cycle is really expensive. motorshop
I am trying to predict the value of DEPARTMENT (i.e. my output class), by consuming - CATEGORY, SERVICE and TITLE - as my input classes.
Pseudo code::
Converted CATEGORY and SERVICE columns into fixed numerical values -
df['CATEGORY'], mapp0 = df['CATEGORY'].factorize()
df['SERVICE'], mapp1 = df['SERVICE'].factorize()
For the TITLE, used NLTK and Tf-IDf techniques to create a sparse matrix with the individual word (tokens) as features and the weights forming the matrix values.
Then outputs of 1 and 2 are combined to form another sparse matrix, which is my main feature matrix (It has approximately 1100 features).
I'm so new to ML that not even sure if step#3 is even allowed (or not even a standard practice).Next, the usual steps are performed like CV, fit, predict, etc.
I am using LinearSVC
and StratifiedKFold (n_splits = 10, random_state=777, shuffle=True)
able to achieve a prediction accuracy of 73%.
Question::
I want to pass inputs (CATEGORY, SERVICE and TITLE) to my model and it should predict the DEPARTMENT. How can I achieve this part?
scikit-learn predictive-modeling pandas multiclass-classification
$endgroup$
add a comment |
$begingroup$
Let me give you a high-level design (blueprint) of my model.
Input data::
CATEGORY SERVICE TITLE DEPARTMENT
apple fruits i love eating fruits. fruitshop
mango fruits mangoes are yellow in color. fruitshop
cycle vehicle that cycle is really expensive. motorshop
I am trying to predict the value of DEPARTMENT (i.e. my output class), by consuming - CATEGORY, SERVICE and TITLE - as my input classes.
Pseudo code::
Converted CATEGORY and SERVICE columns into fixed numerical values -
df['CATEGORY'], mapp0 = df['CATEGORY'].factorize()
df['SERVICE'], mapp1 = df['SERVICE'].factorize()
For the TITLE, used NLTK and Tf-IDf techniques to create a sparse matrix with the individual word (tokens) as features and the weights forming the matrix values.
Then outputs of 1 and 2 are combined to form another sparse matrix, which is my main feature matrix (It has approximately 1100 features).
I'm so new to ML that not even sure if step#3 is even allowed (or not even a standard practice).Next, the usual steps are performed like CV, fit, predict, etc.
I am using LinearSVC
and StratifiedKFold (n_splits = 10, random_state=777, shuffle=True)
able to achieve a prediction accuracy of 73%.
Question::
I want to pass inputs (CATEGORY, SERVICE and TITLE) to my model and it should predict the DEPARTMENT. How can I achieve this part?
scikit-learn predictive-modeling pandas multiclass-classification
$endgroup$
$begingroup$
What kind of model do you have? scikit classifier, XGBoost, LGBM, Tensorflow, Keras or what?
$endgroup$
– Simon Larsson
yesterday
$begingroup$
Thanks Simon. Amidst the long post, had forgotten to put the most important thing. I've edited my post now with the requested detail. I'm using LinearSVC() with StratifiedKFold (10 splits).
$endgroup$
– ranit.b
yesterday
$begingroup$
Any advise please...
$endgroup$
– ranit.b
1 hour ago
add a comment |
$begingroup$
Let me give you a high-level design (blueprint) of my model.
Input data::
CATEGORY SERVICE TITLE DEPARTMENT
apple fruits i love eating fruits. fruitshop
mango fruits mangoes are yellow in color. fruitshop
cycle vehicle that cycle is really expensive. motorshop
I am trying to predict the value of DEPARTMENT (i.e. my output class), by consuming - CATEGORY, SERVICE and TITLE - as my input classes.
Pseudo code::
Converted CATEGORY and SERVICE columns into fixed numerical values -
df['CATEGORY'], mapp0 = df['CATEGORY'].factorize()
df['SERVICE'], mapp1 = df['SERVICE'].factorize()
For the TITLE, used NLTK and Tf-IDf techniques to create a sparse matrix with the individual word (tokens) as features and the weights forming the matrix values.
Then outputs of 1 and 2 are combined to form another sparse matrix, which is my main feature matrix (It has approximately 1100 features).
I'm so new to ML that not even sure if step#3 is even allowed (or not even a standard practice).Next, the usual steps are performed like CV, fit, predict, etc.
I am using LinearSVC
and StratifiedKFold (n_splits = 10, random_state=777, shuffle=True)
able to achieve a prediction accuracy of 73%.
Question::
I want to pass inputs (CATEGORY, SERVICE and TITLE) to my model and it should predict the DEPARTMENT. How can I achieve this part?
scikit-learn predictive-modeling pandas multiclass-classification
$endgroup$
Let me give you a high-level design (blueprint) of my model.
Input data::
CATEGORY SERVICE TITLE DEPARTMENT
apple fruits i love eating fruits. fruitshop
mango fruits mangoes are yellow in color. fruitshop
cycle vehicle that cycle is really expensive. motorshop
I am trying to predict the value of DEPARTMENT (i.e. my output class), by consuming - CATEGORY, SERVICE and TITLE - as my input classes.
Pseudo code::
Converted CATEGORY and SERVICE columns into fixed numerical values -
df['CATEGORY'], mapp0 = df['CATEGORY'].factorize()
df['SERVICE'], mapp1 = df['SERVICE'].factorize()
For the TITLE, used NLTK and Tf-IDf techniques to create a sparse matrix with the individual word (tokens) as features and the weights forming the matrix values.
Then outputs of 1 and 2 are combined to form another sparse matrix, which is my main feature matrix (It has approximately 1100 features).
I'm so new to ML that not even sure if step#3 is even allowed (or not even a standard practice).Next, the usual steps are performed like CV, fit, predict, etc.
I am using LinearSVC
and StratifiedKFold (n_splits = 10, random_state=777, shuffle=True)
able to achieve a prediction accuracy of 73%.
Question::
I want to pass inputs (CATEGORY, SERVICE and TITLE) to my model and it should predict the DEPARTMENT. How can I achieve this part?
scikit-learn predictive-modeling pandas multiclass-classification
scikit-learn predictive-modeling pandas multiclass-classification
edited yesterday
Stephen Rauch♦
1,52551330
1,52551330
asked yesterday
ranit.branit.b
808
808
$begingroup$
What kind of model do you have? scikit classifier, XGBoost, LGBM, Tensorflow, Keras or what?
$endgroup$
– Simon Larsson
yesterday
$begingroup$
Thanks Simon. Amidst the long post, had forgotten to put the most important thing. I've edited my post now with the requested detail. I'm using LinearSVC() with StratifiedKFold (10 splits).
$endgroup$
– ranit.b
yesterday
$begingroup$
Any advise please...
$endgroup$
– ranit.b
1 hour ago
add a comment |
$begingroup$
What kind of model do you have? scikit classifier, XGBoost, LGBM, Tensorflow, Keras or what?
$endgroup$
– Simon Larsson
yesterday
$begingroup$
Thanks Simon. Amidst the long post, had forgotten to put the most important thing. I've edited my post now with the requested detail. I'm using LinearSVC() with StratifiedKFold (10 splits).
$endgroup$
– ranit.b
yesterday
$begingroup$
Any advise please...
$endgroup$
– ranit.b
1 hour ago
$begingroup$
What kind of model do you have? scikit classifier, XGBoost, LGBM, Tensorflow, Keras or what?
$endgroup$
– Simon Larsson
yesterday
$begingroup$
What kind of model do you have? scikit classifier, XGBoost, LGBM, Tensorflow, Keras or what?
$endgroup$
– Simon Larsson
yesterday
$begingroup$
Thanks Simon. Amidst the long post, had forgotten to put the most important thing. I've edited my post now with the requested detail. I'm using LinearSVC() with StratifiedKFold (10 splits).
$endgroup$
– ranit.b
yesterday
$begingroup$
Thanks Simon. Amidst the long post, had forgotten to put the most important thing. I've edited my post now with the requested detail. I'm using LinearSVC() with StratifiedKFold (10 splits).
$endgroup$
– ranit.b
yesterday
$begingroup$
Any advise please...
$endgroup$
– ranit.b
1 hour ago
$begingroup$
Any advise please...
$endgroup$
– ranit.b
1 hour ago
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "557"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f49056%2fhow-to-pass-inputs-interactively-to-a-model%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Data Science Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f49056%2fhow-to-pass-inputs-interactively-to-a-model%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
$begingroup$
What kind of model do you have? scikit classifier, XGBoost, LGBM, Tensorflow, Keras or what?
$endgroup$
– Simon Larsson
yesterday
$begingroup$
Thanks Simon. Amidst the long post, had forgotten to put the most important thing. I've edited my post now with the requested detail. I'm using LinearSVC() with StratifiedKFold (10 splits).
$endgroup$
– ranit.b
yesterday
$begingroup$
Any advise please...
$endgroup$
– ranit.b
1 hour ago