I have a question regarding the process to make a late fusion between SVM (Linear) and a NeuralNetwork (NN),
I have done some research and I found that concatenated the clf.predict_prob of SVM and Model.predic of NN, I should train the new model, however, these scores are for the test data and I cannot figure what to do with the training data.
In other words, I train the new model with the concatenated probability scores of the test data from my two models (SVM and NN) and I test this new model with the same concatenated data, and I'm not really sure of this.
Can you please give me an insight into if this is correct?
After a lot of searching and research I found the solution:
The solution is to train and test a new classifier, in my case it was another Neural Network, with the concatenated probability scores obtained from both data sets (training and test), of the two classifiers, the Linear SVM and the Neural Network.
An example of this of three Linear SVM Late fusion was implemented in python, and can be found in the following link:
https://github.com/JMalhotra7/Learning-image-by-parts-using-early-and-late-fusion-of-auto-encoder-features
Related
The dataset i am working on has 7 input features and 4 output class. The length of my dataset is 160. Will neural network be a good choice here? If so, how should i take my inputs to the neural network. Since I have 4 output class, i am going to use Softmax in the final layer.
If neural network makes no sense in such a small dataset, then what are the possible good Machine Learning Algorithms for have a great result in this kind of problems?.
Thanks 😊
What kind of a dataset do you have? I am assuming a tabular dataset.
You can use a neural network if you must. However, for such a small dataset, a neural network isn't usually advisable. You should rather look into the following classifiers:
Decision Tree
Naive Bayes
Multi-class Logistic Regression
Support Vector Machine
Ensemble models (Random Forest and/or Gradient Boosting)
So basically I want to classify a lot of labels (200K+).
Are there any recommended models I should try in order to have a relatively good accuracy and not take days to complete?
I have tried to use Sklearn's OneVsRestClassifier for LinearRegression, and I left it overnight and the fitting still didn't finish
I believe that there should be more efficient algorithms for multiclass classification for NLP
Thanks in advance
Given the amount of data that you have available, consider multinomial Naive Bayes. Sklearn has a very straight forward implementation of this: https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.MultinomialNB.html
This will be quicker than using a neural network. A lot of training data on a simple model will always have more predictive power than a larger model with less data.
Can any one please help me out?
I am working on my thesis work. Its about Predicting Parkinson disease, Since i want to build an LSTM model to adapt independent of patients. Currently i have implemented it using TensorFlow with my own loss function.
Since i am planning to introduce both labeled train and unlabeled train data in every batch of data to train the model. I want to apply my own loss function on this both labeled and unlabeled train data and also want to apply cross entropy loss only on labeled train data. Can i do this in tensorflow?
So my question is, Can i have combination of loss functions in a single model training on different set of train data?
From an implementation perspective, the short answer would be yes. However, I believe your question could be more specific, maybe what you mean is whether you could do it with tf.estimator?
Problem Statement - Classify a product review
classes - Travel,Hotel,Cars,Electronics,Food,Movies
I am approaching this problem with the famous Text Classification problem. Feature set is prepared by using Doc2Vec default model from gensim and for classification I am using Logistic Regression oneVSrest from sklearn.
For every class I feed 10000 reviews to Doc2Vec.( I am following this Doc2Vec tutorial). In this way the model learns vector for each sentence. From the resulting vectors, 80% from each class are given to LogisticRegression for training and 20% for testing. The accuracy of classifier is 98%. But for unseen data the accuracy is just 17%. Also PCA of all sentence vectors when plotted in a 2D graph resulted in one dense cluster. What I can conclude from the graph is that the data is inseparable but then how the classifier gave an accuracy of 98%? Also, why on unseen data the accuracy is very low? How can I evaluate/validate my results.
I am performing a machine learning task wherein I am using logistic regression for topic classification.
If this is my code:
model= LogisticRegression()
model= model.fit(mat_tmp, label_tmp)
y_train_pred = model.predict(mat_tmp_test)
print(metrics.accuracy_score(label_tmp_test, y_train_pred))
Is there a way I can output what exactly is happening inside the model. Like probably a working example of what my model is doing? Like maybe displaying 2-3 documents and how they are being classified?
In order to be fully aware of what is happening in your model, you must first take some time to study the logistic regression algorithm (eg. from lecture notes or Wikipedia). As with other supervised techniques, logistic regression has hyper-parameters and parameters. Hyper-parameters basically specify how your algorithm runs, which you must provide at initialisation (ie. before it sees any data). For example, you could have prior information about the distribution of classes, which then would be a hyper-parameter. Parameters are "learnt" from your data.
Once you understand the algorithm, the interesting question will be what the parameters of your model are (recall that these are retrieved from the data). By visiting the documentation, you find in the attributes section, that this classifier has 3 parameters, which you can access by their field names.
If you are not interested in such details, but only want to assess the accuracy of your classifier, a useful technique is cross-validation. You split your labeled data into k equal sized subsets, and train your classifier using k-1 of them. Then you evaluate the trained classifier on the remaining 1 subset and calculate the accuracy (ie. what proportion of the data could be predicted properly). This method has its drawbacks, but proves to be very useful in general.