Questions tagged [python-3.x]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

How to make a popularity-based recommender system having data on posts and number of likes? Please review a code

I'm writing a popularity-based recommendation system, where I have data on posts and likes the posts have. I need to recommend posts to a user based on their popularity (obtained likes). Packages and ...
0
votes
1answer
23 views

how to use feature engineering on a label

I found a dataset about DDOS attacks id like to use but the tool used to extract features from pcap files seems to have indented the columns a little weird as seen below there are indents in unusual ...
0
votes
1answer
9 views

Map dictionary with list to columns in pandas [closed]

I am trying to map a dictionary with the following structure dict = {A:[1,2], B:[2,3], C:[4,5]} as two new columns in a pandas dataframe based on each key.
0
votes
0answers
34 views

Combine features in Machine Learning KNN

I'm trying to build a simple book recommendation system, where I don't have any kind of ratings (no comments, no likes, no 1-5 stars, ...). The information I can use is the following: Book metadata ...
1
vote
0answers
22 views

End to end k-means clustering - python

i'd like to share with you my path in a clustering exercise (via K-means using python), in order to understand if i made some errors or if there is something more that can i do. General Overview My ...
1
vote
1answer
11 views

Find the optimal n_estimator by looping the model accuracy indicator in random forest algorithm - python

i'm trying to find the best n_estimator value on a Random Forest ML model by running this loop: ...
0
votes
1answer
8 views

How to check the randomness or the distribution of an attribute in a dataset?

I have a dataset. I want to make its randomness nature match with another dataset (2nd one). Basically I want to modify the 2nd dataset values and make them similiar in distribution or nature in ...
0
votes
1answer
22 views

ImageDataGenerator - trained with model.fit instead of model.fit_generator [closed]

I am a beginner in using the ImageDataGenerator from Keras and I accidentally used model.fit instead of model.fit_generator. ...
1
vote
1answer
46 views

How to use Cosine Distance matrix for Clustering algorithms like mean-shift, DBSCAN, and optics?

I am trying to compare different clustering algorithms for my text data. I first calculated the tf-idf matrix and used it for the cosine distance matrix (cosine similarity). Then I used this distance ...
0
votes
1answer
31 views

how to build word2vec content based recommendation?

I am building a content-based recommendation system for hotel accommodation. I have a hotel name, hotel description and location. I combined hotel name, description and location. Then, applied NLP and ...
0
votes
1answer
29 views

How to Minimize mean square error using Python

I want to minimise mean square error function to find best alpha value (decay rate) for my model. Here is the description of my model: ...
2
votes
1answer
35 views

How to test/train a model for realtime data with new data points and classes in a ML pipeline

First, For a text classification problem, if I have trained the model on 2 classes and it gives good accuracy. Now, when I use the model in real-time, there is a completely new class from a totally ...
0
votes
1answer
20 views

How to obtain unique count of categorical variable based on another categorical variable?

I have a dataframe with date and cat_1 variables among other variables. I want to get number of unique values of ...
0
votes
1answer
29 views

Reshaping Pandas DataFrame

I am trying to do the following as shown below. ...
0
votes
1answer
50 views

Low memory error while performing degree 2 polynomial regression on (3000*1835) sized array

I am working on a problem to predict the revenue, a film will generate. Some of the features available in the data set are json collection for the crew, cast which worked in the film. I applied ...
0
votes
0answers
16 views

Get row wise frequency count of words from list in text column pandas

I have a data frame with a Audio Transcript column from customer care phone conversation. I have created one list with words and sentences ...
0
votes
1answer
33 views

What is the best way to store images in python for machine learning

I am currently working on a classification problem that requires me to classify whether an image contains cancerous tissue cells or not. Each image is 50x50x3 pixels, the 3 is for RGB values. So far ...
0
votes
2answers
34 views

Random Forest - ValueError: Input contains NaN, infinity or a value too large for dtype('float32')

I'm trying to apply the RandomForest method to a dataset and I get this error: ValueError: Input contains NaN, infinity or a value too large for dtype ('float32') ...
0
votes
0answers
24 views

Custom training loss with custom gradients

I am trying to write a custom loss in Tensorflow v2, for simplicity let's say that I'm using Mean Squared Error loss as follows, ...
1
vote
1answer
46 views

How is the Gridsearchcv Score calculated?

How is the score of gridsearchcv calculated? Is the score a percentage? Does this mean higher is a better? Thank you
0
votes
1answer
62 views

Validation Loss is not decreasing - Regression model

I'm trying to train a regression model with 6 input features. No. of tuples - 7287. Train set - 5465 Test set - 1822 I've tried changing no. of hidden layers and hidden neurons, early stopping, ...
0
votes
0answers
105 views

confusion matrix results in CNN keras

I am writing a code to classify images from two classes, dogs and cats. I wrote the below code, but always all the dogs images are classified as cats as shown in the confusion matrix. Am I missing ...
3
votes
1answer
32 views

Pandas dataframe, create columns depending on the row value

I get a csv that if you read it, looks like: ...
0
votes
1answer
115 views

Feature Importance from a GridSearchCV

I created a GridSearchCV for a Random Forest Regressor. Now i want to check the feature importance. I searched around and I found this ...
2
votes
0answers
34 views

Confused about the MSE ERROR

I am created a random forest regressor and calculate my own error. I want also to calculate MAE, MSE and RMSE to compare my results to similar usecases. But the results of the MAE, MSE, RMSE are ...
1
vote
2answers
29 views

How many trees does a random forest need?

At first, I did a GridsearchCV and the best parameter is a random forest with just 100 trees. My trainset has 80.000 rows and 669 columns. My test set has 20.000 rows and 669 columns. How is it ...
4
votes
2answers
57 views

It is alright to split a GridSearchCV?

Is it ok to split a GridsearchCV? At first, I would try estimators from 100 - 300 (100 steps) for a random forest regressor and some other parameters and after that GridsearchCV I would start the ...
2
votes
1answer
32 views

Why does my GridSearcCV always break up?

My GridSearchCV for my random forest breaks up. I need to know the reason and the solution to make it work: ...
2
votes
1answer
40 views

Bagging or Random Subspace Method for Random Forest?

I am reading a lot about the random forest regressor. I reading about bagging (bootstrap and aggregation) and random subspace. But I am not sure if the random forest regressor just using bagging or ...
-1
votes
2answers
41 views

Creating Pandas DataFrames from a dictionary containing various CSV files

I want to create 3 dataframes (i.e., gs, test and train) from the following dictionary: ...
1
vote
0answers
35 views

How to interpret training results

I am working on an image similarity network. I have around 90,000 pairs of images contain an equal number of positive and negative samples. For learning the similarity between image pairs, I used the ...
2
votes
0answers
49 views

Multi-output regression python

I am new to machine learning and cannot figure a way to solve this problem: I have X which is always one row/record while the y can be a row or more. Here is a simple sample from my data-set, 'i ...
1
vote
1answer
217 views

how to sort a multi-level pandas data-frame by a particular column?

I want to sort a multi-index pandas dataframe by a column but don't want the entire dataframe to be sorted at once. But rather want to sort by one of the indices. Here is an example of what I mean: ...
1
vote
0answers
108 views

Lemmatization of pandas column using Wordnet after POS

I have a pandas column df_travail[line_text] with text. I want to lemmatize each word of this column. First I Lowercase the text : ...
-1
votes
1answer
143 views

NumPy — ImportError: PyInit__multiarray_umath [closed]

I'm facing the below error while importing NumPy library. I have tried all of the suggestions advised by Python in its error log, but no luck. Strangely, when I use Python's OS library and print the "...
1
vote
1answer
178 views

Spacy v2.0.1 custom NER: How to improve training of existing model

I implemented custom NER with bellow trained data first time and it gives me good prediction with Name and PrdName. I mentioned code bellow. ...
0
votes
0answers
81 views

Running python project with several .py on Google Colab

Running python project with several .py on Google Colab On Google colab, I tried to execute a python project which has several python files (.py). I have saved all files in my google drive and ...
1
vote
1answer
109 views

Python Pandas agg error

I am trying to generate descriptive statistics using agg function in Pandas. I am having trouble with one line with a lambda function. They work when I run them as separate lines of code, but when I ...
2
votes
0answers
146 views

Expected performance of training tf.keras.Sequential model with model.fit, model.fit_generator and model.train_on_batch

I am using Keras with Tensorflow backend to train a simple 1D CNN to detect specific events from sensor data. While the data with tens of millions samples easily fits to the ram in the form of an 1D ...
1
vote
2answers
53 views

Different results for LogisticRegression on python 2.7 and 3

I have different results for the same kernel on python 2.7 (local machine) and python3 (the system running on kaggle) for LogisticRegression. How it is possible? Here my results from my local machine:...
0
votes
1answer
188 views

Calibrating Correlation

I am facing a weird problem in my on going project and thought if someone here could help me out with this. Actually I have large data set. I have to perform a regression task on top of that. While ...
1
vote
1answer
26 views

Is there a python code to perform the following task in python

Is there a way by which I can find how many people rated below 60% or how much percentage of people gave a rating of less than ...
1
vote
1answer
23 views

How should I improve my Vectorized Gradient descent linear regression model?

I wrote a vectorized Gradient descent implementation of the linear regression model. The Dataset looks something like: It's Not Working properly as I am getting negative R Squared error I don't ...
0
votes
1answer
185 views

Unable to import xgboost 0.9

When running import xgboost as xgb print(xgb.__version__) I am getting the following error: ...
0
votes
0answers
136 views

Logistic Regression Plotting Learning Curve and Decision Boundary with Python

I already trained a dataset with Logistic Regression. However , I could not find any plotting code blocks of learning curve and decision boundary of my trained data. I put my codes at below. So , how ...
0
votes
0answers
66 views

How to add new csv file data into training LSTM model to predict next future value using python

Here I have a data csv file with four inputs. I want to predict next value using LSTM model. first of all I train the LSTM model with data. Here is my code: ...
0
votes
0answers
14 views

Scraping mixed elements and passing to SQL

I'm running webscrapes via python which are retrieving data from csv's hosted on the web. I'd like to pass the data into a MSSQL database. An issue I have is the mixed elements/data types in the csv....
0
votes
0answers
9 views

From stationary value to original value

...