New answers tagged

0

My experience is oversampling with replacement may gives better classification performance than SMOTE on imbalanced data although the latter is considered more advanced than the former. If the minority classes are too small, the synthetic data generated by SMOTE can have wrong labels i.e. a synthetic instance is class 0 (a minority class) but should be class ...


0

You should probably consider a simple case of conditional probabilities - for example, a Naive Bayes Classifier. Assuming for example that you are using Python, you could look up an example of "Naive Bayes spam classifier" - in your example, you would need to rely on 5 cases, instead of the default 2 that spam engines rely on. An example can be ...


1

First, apply min-max normalization on the training set rather than the whole data set. Then, use the minimum and maximum of the training set to normalize the test set. Because, the test set is unseen by the model and should be normalized using the minimum and maximum of the training set (seen by the model).


0

The boost cannot be guessed in advanced..But what has been seen is that model start learning and gives much better performance so that model is acceptable in most cases if you have enough data and good training data.


0

I have read about SVM ...I know that it produces decision plane SVM does not explicitly produce a decision plane; it is not a parametric method. The decision plane implied by the fitted SVM can be visualized in two or three dimensions, but the plane merely results from the class labels and weights of the training observations. If the decision plane would ...


0

The weights refers to the weights assigned to misclassified samples. Adaboost assigns weights to each misclassified observations based on the calculation showed above. When it trains boosting model this weights help model to give more importance to misclassified observations


4

If You have only females in your dataset, adding gender feature to the model input will not improve it. The technical explanation on why it won't help changes between models, but the intuition is simple - the model tries to find correlation between the features and the labels, and the correlation between any variable and a fixed-value variable is zero. You ...


0

The reason for this seems to be your are importing from tensorflow.keras.layers import * But while your are calling you are using : layers.Input(shape=(IMG_SIZE, IMG_SIZE, 3)) this calling will give you an error so instead try below import Please try this import : from tensorflow.keras import layers


0

Adaboost is a model (ensemble) that starts with high bias but low variance, in contrast with bagging ensembles that are models with a high variance but low variance (see fig 1.) Although the original paper makes usage of decision tree stumps, you could theoretically make use of any other classifier, more precisely of unstable classifier The process of ...


1

In case you have labeled data (previous complaints labeled by humans), you can implement a standard binary text classification model. A rather simple approach would be to encode the text e.g. as TFIDF or "one hot" and run a simple classification task to learn of some text belongs to label "referred" or "not referred" (which ...


0

a) Any intelligent way to assign likelihood to this table? Your conversions are essentially an outcome of two functions, your biz team and the procurement team/contact of the client. The common denominator is your biz team. Consequently, in order to be able to predict likelihood you need recorded metrics of your biz team's both successful and unsuccessful ...


0

According to your requirements, this dataset will be a good choice for you to work on. It is available on Kaggle: https://www.kaggle.com/lakshmi25npathi/imdb-dataset-of-50k-movie-reviews?select=IMDB+Dataset.csv IMDB dataset has 50K movie reviews for natural language processing or Text analytics. This is a dataset for binary sentiment classification ...


1

Provided you have the data already, and the data is labelled (i.e., split into the two classes $A$ and $B$), it makes sense to produce a number of visualisations to gauge what the model output would be. If you start with traditional classification algorithms like logistic regression, then the model output is going to be the probability of belonging to a ...


1

Since you didn't mention this in the description, let me first emphasize that these graphs show the performance for different sizes of the training set, i.e. this is the result of an ablation study. This is important because it means that every point on the X axis represents a different model. Now, what these two graphs show is clear overfitting on the left ...


0

What you are looking for is a so-called sentiment-analysis in NLP. In this article, you will find an instruction on how to train a Convolutional Neural Network with a BERT Encoder for a sentiment-analysis. You could use this example and just replace the training data with movie reviews (positive / negative) with some of your labeled data. Definitely worth a ...


1

A sigmoid function is a function with specific properties, most notably it maps values to the interval $[0,1]$. Often "sigmoid" is used to describe "some" s-shaped function which maps values to the interval $[0,1]$. If you take the logistic function $$ f(x) = \frac{L}{ 1 + e^{-k(x-x_0)} },$$ with $k=1, x_0=0, L=1$ ($x_0$ midpoint, $L$ ...


1

This sounds like the AUPRC is being done on the training (downsampled) set. Compare the models on the same validation set. AUPRC does not solve all issues either. It is just another metric with strengths and weaknesses. Interpretation, getting (un)lucky with the highest score observation, and some issues pointed out here. Just the highest scored observation ...


1

You never downsample your test data. Test data should maintain same %age as original distribution of classes. You compare test reseults before and after sampling to see if it works


0

As stated in the docs, the KNeighborsClassifier from scikit-learn uses minkowski distance by default. Other metrics can be used, and you can probably get a decent idea by looking at the docs for scikit-learn's DistanceMetric class


0

It depends on the contextual link between A and B. If they are completely different categories with no or low correlation, there shouldn't be necessary to have a single class multi label. But if A and B are somehow connected, overall if they can represent a scale together (i.e. AB = [0 0] = 0 = "low impact" or AB = [1 1] = 3 = "high impact&...


0

With such imbalanced data, the area under the ROC curve is not really informative. Area under the precision recall curve is better.


1

You could simulate data and fit a model to it as if it were real data. there are packages and functions in R and Python to do this. You'd have to be very clear that the data is faked. You could then examine the model and produce graphs as if it were a real one. This has the downside that it involves writing all the code and writing code to sim data, which ...


1

I expected scikit to allocate completely new memory space for corresponding model during fit() call, which does not happen to be the case. So in the first case by calling models[component].append(model) I tend to save the address of model rather than the deep copy of the model itself. Later on, this model gets overwritten by the next one and so on. ...


1

Look at your past experience. Even though you're a novice, you were hired as a data scientist, so you'll probably have some experience with data science projects. A simple binary classification problem with a few hundred datapoints can be solved in a productive afternoon, whereas a large project that requires significant upfront engineering for the ...


0

Probably treating this problem as a text classification one would generalize in a better way than using screenshots. Most „down“ pages will likely say something indicating that the service is no longer available. So scrapping the visible text of the pages and using a simple count vectorizer or so could be more reliable than classifying images.


1

The reason you are not seeing any verbose output from the model fitting and no change in the model's labels is because the treshold you are currently using is too high, which doesn't allow the model to add any new pseudo-labels to the dataset. Decreasing the threshold (e.g. to 0.7) does show output with the number of labels added in each iteration: End of ...


2

The positive/negative distinction is not what the precision/recall pair of measures tries to capture. precision measures the proportion of correctly predicted instances among the instances predicted as positive. In other words, if X is the precision then one can say "when the classifier predicts an instance as positive, it is correct X% of the time&...


0

Better approach would definitely be supervised learning model. There are two alternatives for you to go: (1) What you could try is to use a transformer model that was trained on another sentiment case, like movie or restaurant reviews. First, you could try how this model works for your use-case and then use it to label your unlabeled data. (2) Or you could ...


1

You can use bart-large-mnli model open-sourced by facebook and is available here Once you download all the files you can create a microservice and expose it as an API or alternatively run it in batch processing model


0

When we have such a imbalanced dataset, it is always a good practice to do hyperparameter tuning of some randomly sampled data. Once you get the best parameters apply it complete datasets For dealing with imbalanced I think craig has already pointed out links.


0

I don't think evaluating clustering output labels using classification makes sense. As if K means has created those cluster mostly they will be separable on the input classes. To Validate your clustering model you should be doing the following. Look at Silhoutte Analysis for cluster = 7, and see if its well seprated Do the profiling of all the variables to ...


0

To a human observer it is obvious that "A" and "E" are different because they show a different pattern in their amplitude compared to "B" "C" and "D". The trajectory of "E" doesn't even look that different for the most part, it just jumps up and down rapidly at certain intervals. My idea would be to ...


0

One method to consider is Dynamic Time Warping (DTW), which measures similarity between time series. DTW is capable of comparing time series of different lengths, and the resulting score could be used to determine which series are most unique in your sample. You'll find in many articles that DTW works well with KNN classification (I personally can attest to ...


2

The answer to such wide questions always have the same answer - it depends. Since I don't know the exact ratio of the four classes, I'll mention a few important points that can help you decide how to move forward. Different people set different thresholds for when their dataset is imbalanced, I'm refraining from giving you an exact percentage but the general ...


1

The specificity is defined as $Specificity = \frac{\sum{True Negative} }{\sum{True Negative} + \sum{False Positive} }$. These counts are strictly positive values and as such the specificity cannot be negative. You can also see that the specificity must be less than 1 because it is a ratio. For more details on sensitivity and specificity you can check this ...


0

One option is to embed all the information in a single space. The embedding space would contain the tokens and feature names. Often times the tokens are changed to track the provenance. For example, science__DOMAIN and professor__COMMENT_BY. An example of a package that does that is StarSpace.


0

More data is not always better. How do you know it is unsatisfactory to not consider older data? In your case it might actually improve the performance of your model. I would pefer one of the first two suggested methods, and see what their effect is on your performance indicator(s) compared to the time-naive baseline. As a side note, do you have any clue ...


1

One option could be to use a BERT encoder to tokenize and encode the words and then use a Convolutional Neural Network for the classification task. If you need a tutorial on how to do it, check this article. Also you can fine-tune a Transformer model, like BERT or Google's T5, to do the classification. But they can take long to train, so try CNN first and if ...


0

It is not useful for generalization to encode target variable information in a feature. That is data leakage, providing the model with additional information that is not available at prediction.


0

Some of your assumptions are incorrect, let me try to explain this: To predict mortality you have to feed the model with mortality data and I think if you have mortality data, then it is probably too late to use the model. In supervised learning it's crucial to distinguish two very different kinds of "input": The training data is made of many ...


0

To handle the class imbalance, I am aware of two broad categories of techniques. The first type of technique directly solves the problem by changing the data distribution itself. On the other hand, the second type of technique plays with the loss function to solve the problem. Over Sampling and Under Sampling techniques Modifying Loss functions I believe ...


1

This can be solved by simply changing the method that is called within transform to the transform method of the vectorizer. In addition you would also have to add a call to fit within the fit method to make sure that the vectorizer is actually fitted before being used to transform any data: class Vectorizer(BaseEstimator, TransformerMixin): def __init__(...


2

I would reccomend you to encode high cardinality categorical variables with Target Encoding methods: Python Library: https://contrib.scikit-learn.org/category_encoders/ Paper: https://link.springer.com/chapter/10.1007%2F978-3-030-85529-1_14 If you want to understand what the model is doing, I would recommend you to look at the Interpretability book https://...


3

Let's answer you questions one by one. a) Since there are more than 100 unique products, should I create one hot encoding variables for all my 100 products? There are many ways to encode a categorical variable, a list of them you can find here. Which one you should use depends on your data. Categorical variables can be of many types like ordinal, nominal, ...


0

If you would already have those datapoints before a company actually goes into bankruptcy then you can then them in your model since when predicting to the future you could have access to that data. However, if you would only know the data once the bankruptcy event happens (e.g. date of bankruptcy) then you cannot use this variable in your model since you ...


0

This can be accomplished by weighting the samples in the loss function calculation. In sklearn, that's done using the sample_weights argument of the fit method. You'd set that parameter as an array, whatever function of your f1 that's most appropriate.


0

Mapping categorical levels to integer values is commonly called feature hashing / hashing trick. Feature hashing can be useful for certain machine learning algorithms (e.g., tree-based and neural networks). However, linear models (e.g., logistic regression) will be unable to learn the relationship between hashed features and target values.


0

I would discourage such a practice. If you use this for your outcome variable, you are making a wrong distribution assumption. You risk getting nonsense predictions like being in between a cat and a crocodile. With a categorical (multinomial) distribution, you wind up with fractional predictions, yes, but those have reasonable interpretations as class ...


1

Although this is not a demonstration by an experimental exercise (we can actually try it out), you can get an intuitive understanding because, while PR-AUC uses Precision and Recall as indicators: ROC-AUC uses Recall and FPR (False Positive Rate) which makes use of the TN (True Negatives) value which, for datasets with a high imbalance, is likely to be high ...


0

You might not be building your model correctly. Here is an alternative way to build a model: from tensorflow.keras.models import Sequential layers =[ spectrogram = Input(shape=(time_steps, feature_size)) layer0 = Reshape((time_steps, feature_size, 1)) layer1 = Conv2D(32, kernel_size=(3,3), padding='same') layer2 = MaxPooling2D(pool_size=(4,4)) layer3 = ...


Top 50 recent answers are included