Questions tagged [machine-learning]

13047 questions
0

votes
0

answer
3

Views

how to use eager execution to save and restore in TensorFlow?

We always use tf.train.Saver() to save and restore weights, like the following example(https://www.tensorflow.org/guide/saved_model). But how to use eager execution to save? how to change the following example? Another question, is it a good idea to use eager? I fond tf.contrib.eager.Saver in (ht...
andy
1

votes
1

answer
888

Views

Feature scaling using python StandardScaler produces negative values

I am a newbie in Machine learning. I am trying to use feature scaling on my input training and test data using the python StandardScaler class. However, when I see the scaled values some of them are negative values even though the input values do not have negative values. Is this normal or am I miss...
Amit Rastogi
1

votes
2

answer
852

Views

How to interpret MSE in Keras Regressor

I am new to Keras/TF/Deep Learning and I am trying to build a model to predict house prices. I have some features X (no. of bathrooms , etc.) and target Y (ranging around $300,000 to $800,000) I have used sklearn's Standard Scaler to standardize Y before fitting it to the model. Here is my Keras mod...
Ivan
1

votes
1

answer
82

Views

java.lang.IllegalArgumentException: Matrix inner dimensions must agree

Here is my code: package algorithms; import Jama.Matrix; import java.io.File; import java.util.Arrays; public class ThetaGetter { //First column is one, second is price and third is BHK private static double[][] variables = { {1,1130,2}, {1,1100,2}, {1,2055,3}, {1,1047,2}, {1,1927,3}, {1,2667,3}, {1...
Aadit Kolar
1

votes
2

answer
269

Views

Correct implementation of weighted K-Nearest Neighbors

From what I understood, the classical KNN algorithm works like this (for discrete data): Let x be the point you want to classify Let dist(a,b) be the Euclidean distance between points a and b Iterate through the training set points pᵢ, taking the distances dist(pᵢ,x) Classify x as the most frequ...
Daniel
0

votes
0

answer
19

Views

how to handle with continuous values in array

I would like to create a submission file to the problem, but my predictions got continuous values in the array, please help me how to solve. I have array values like this: predictions array([[5.5161709e-01, 4.4297403e-01, 5.3959554e-03, 1.2935511e-05], [5.5161709e-01, 4.4297403e-01, 5.3959554e-03, 1...
suri
1

votes
3

answer
356

Views

Mini Batch Gradient Descent, adam and epochs

I am taking a course on Deep Learning in Python and I am stuck on the following lines of an example: regressor.compile(optimizer = 'adam', loss = 'mean_squared_error') regressor.fit(X_train, y_train, epochs = 100, batch_size = 32) From the definitions I know, 1 epoch = going through all training ex...
Eyal2000
1

votes
1

answer
760

Views

AWS Sagemaker unable to parse csv

I'm trying to run a training job on AWS Sagemaker, but it keeps failing giving the following error: ClientError: Unable to parse csv: rows 1-5000, file /opt/ml/input/data/train/KMeans_data.csv I've selected 'text/csv' as the content type and my CSV file contains 5 columns with numerical content and...
swap709
1

votes
1

answer
165

Views

Does ML.NET CategoricalOneHotVectorizer encode testing data as well?

I'm not sure how ML.NET CategoricalOneHotVectorizer works, from their sample code, var pipeline = new LearningPipeline { // ... extra code ... new CategoricalOneHotVectorizer('VendorId', 'RateCode', 'PaymentType'), // ... extra code ... new FastTreeRegressor() }; looks to me that once we call model...
HuyNA
1

votes
1

answer
293

Views

KERAS “sparse_categorical_crossentropy” question

As an input a have a float 1.0 or 0.0. When I try to predict with my model and the sparse_categorical_crossentropy loss I get something like: [[0.4846592 0.5153408]]. How do I know what category it predicts?
user9468014
1

votes
1

answer
587

Views

Stop Training in Keras when Accuracy is already 1.0

How will I stop Keras Training when the accuracy already reached 1.0? I tried monitoring loss value, but I haven't tried stopping the training when the accuracy is already 1. I tried the code below with no luck: stopping_criterions =[ EarlyStopping(monitor='loss', min_delta=0, patience = 1000), Earl...
Eliyah
1

votes
1

answer
168

Views

Trained “Decision Tree” VS “Decision Path”

I am using scikit 'Decision Tree' classifier for predicting the 'effort size' of a migration project. Another part of my requirement is to find the features that are influencing the prediction. I trained the model and I get a hierarchical tree with all features at different nodes. I thought the sam...
Gana
1

votes
2

answer
12

Views

Fitting Logistic Regression model to MNIST data takes very long

I am trying to apply LogisticRegression model from sklearn to the MNIST dataset and i have split the training - test data into a 70-30 split. However, when i simply say model.fit(train_x, train_y) it takes a very long time. I have added no parameters when initiating logisticregression. code : im...
TheNoob
0

votes
0

answer
5

Views

Understanding the given protocol of recommenderlab library in R

I am trying to understand the given protocol of recommenderlab library in R. From the original document https://cran.r-project.org/web/packages/recommenderlab/vignettes/recommenderlab.pdf : Testing is perfomed by withholding items (parameter given). Breese et al. (1998) introduced the four experimen...
Alex S
1

votes
1

answer
47

Views

not able to predict using pytorch [MNIST]

pytorch noob here,trying to learn. link to my notebook: https://gist.github.com/jagadeesh-kotra/412f371632278a4d9f6cb31a33dfcfeb I get validation accuracy of 95%. i use the following to predict: m.eval() testset_predictions = [] for batch_id,image in enumerate(test_dataloader): image = torch.autogra...
Jagadeesh Kotra
1

votes
1

answer
47

Views

How to calculate the steepness of a trend in python

I am using the regression slope as follows to calculate the steepness (slope) of the trend. Scenario 1: For example, consider I am using sales figures (x-axis: 1, 4, 6, 8, 10, 15) for 6 days (y-axis). from sklearn.linear_model import LinearRegression regressor = LinearRegression() X = [[1], [4], [6]...
Emi
1

votes
1

answer
39

Views

K-means on 3D matrix

I am currently learning k-means and wanted to try it on 3D matrix, this is the link through which I am passing 2D matrix. from sklearn.cluster import KMeans import numpy as np X = np.array([[1, 2], [1, 4], [1, 0], [10, 2], [10, 4], [10, 0]]) kmeans = KMeans(n_clusters=2, random_state=0).fit(X) kmea...
user730119
1

votes
1

answer
59

Views

Is Event Sourcing helpful to Machine Learning

I am new to Event Sourcing, Event Store, Message Store and Machine Learning. And we are planning to implement message store and the reason they mentioned about implementing message store (instead traditional db, crud) is because the message store eventually helps in deep learning or machine learning...
Sreekanth Reddy
1

votes
3

answer
45

Views

Concepts to measure text “relevancy” to a subject?

I do side work writing/improving a research project web application for some political scientists. This application collects articles pertaining to the U.S. Supreme Court and runs analysis on them, and after nearly a year and half, we have a database of around 10,000 articles (and growing) to work w...
ecole96
1

votes
1

answer
45

Views

Why are the prediction probabilities so high for images with no defined class?

I have been stuck here for too long now. I am trying to create a CNN that could detect the numbers in an image. For this I started working with The Street View House Numbers (SVHN) Dataset. This dataset comes with pre-processed images scaled to 32x32 digits.There are 10 classes for 10 numbers. I t...
Amanda
1

votes
1

answer
41

Views

Model learns with SGD but not Adam

I was going through a basic PyTorch MNIST example here and noticed that when I changed the optimizer from SGD to Adam the model did not converge. Specifically, I changed line 106 from optimizer = optim.SGD(model.parameters(), lr=args.lr, momentum=args.momentum) to optimizer = optim.Adam(model.parame...
thefxperson
0

votes
0

answer
2

Views

What's the difference between these 2 Keras approaches in Transfer Learning?

I've seen two different approaches for Transfer Learning/Fine Tuning and I'm not sure about their differences and benefits: One simply loads the model, eg. Inception, initialized with the weights generated from training on eg. Imagenet, freezes the conv layers and appends some dense layers to adapt...
crash
0

votes
1

answer
20

Views

How does one identify if the ML model is overfitting the dataset or not?

I have been comparing different regression models from sklearn, On doing so I was confused with the model's score value that i got. Below in the code you can see that i have used both Linear Regression and Ridge Regression but the difference in score values for the training and test data set vary by...
Shankar Ganapathy
0

votes
0

answer
6

Views

I need some suggestion to move forward with my image recognition task

I am currently working on an image recognition problem where I would like to recognize images with the highest probability, meaning the expectation is to match an image having a maximum percentage of match score from the pool of images given input test images. I want any ideas, suggestion or any blo...
user11409134
0

votes
0

answer
5

Views

Revised the KNN model on Iris

I tried to use KNN (applied Euclidean distance) to predict and get accuracy on Iris data without using scikit-learn. However, I have no idea to process the next step. Regression: The summarization of the closest instances could involve taking the mean of the predicted attribute to revise the model....
Jammy
0

votes
0

answer
22

Views

Design neural network to find inputs with highest probability of class

I am designing a neural network for classification with the aim to find the inputs with the highest probability that they belong to one of two classes. There are two classes, class A and class B. I have a set of data of which I want to find the inputs that have the highest probability that they belo...
ig-dev
0

votes
1

answer
14

Views

can not split large .txt file into train, test and validation parts for deep text corrector

I have a single large .txt file and I want to split it into train, test and validation set. below are the lines of code where I want to use those flies. I am not getting any intuition about how to do it. python correct_text.py --train_path /movie_dialog_train.txt \ --val_path /movie_dialog_val.txt...
SRajput
0

votes
0

answer
4

Views

Should YOLOv3 annotations be done before the resize?

I am about to start annotating my images to train a YOLOv3 model. Before starting I want to make sure that it is okay to create the annotations on the original image. Would the annotations change respectively after I resize my images before training? Or should I resize all of my images first then st...
sugar.darre
1

votes
2

answer
93

Views

Calculate TD-IDF for a single word in Textacy

I'm trying to use Textacy to calculate the TF-IDF score for a single word across the standard corpus, but am a bit unclear about the result I am receiving. I was expecting a single float which represented the frequency of the word in the corpus. So why am I receiving a list (?) of 7 results? 'accule...
ardochhigh
1

votes
0

answer
9

Views

Batch Normalization results inconsistent across Keras and Tensorflow for toy example: why?

I'm trying to get BatchNormalization working properly in Keras (2.2.4), and haven't had luck. Its behavior seems inconsistent across model.fit() and model.predict()/evaluate(). My original problem was in the context of a complex GAN setup with various layers that were switching between frozen and u...
user1519525
1

votes
0

answer
13

Views

how to find out the water consumption rate based on the water levels in sump and tank?

Before i predicted the future water consumption rate using ARIMA Model. But now i has to find out and predict the water consumption based on the levels in the tank and the sump.I have the hardware which is measuring the level of sump and tank. I know, i should know the dimension and have to calculat...
Bindu TR
0

votes
0

answer
3

Views

How to fix 'Object arrays cannot be loaded when allow_pickle=False' in the sketch_rnn algorithm

I was running the sketch_rnn.ipynb on my jupyter notebook, upon loading the environment to load the trained dataset, it returned an error 'Object arrays cannot be loaded when allow_pickle=False' This is the code already used by google developers in developing the sketch_rnn algorithm that was even r...
Duncan Jerry
1

votes
0

answer
6

Views

Python: Skater is showing a feature importance error. FeatureImportanceError: Something went wrong. Importances do not sum to a positive value

I am trying to find the global feature importance of a model post training by using Skater as a library. There is an error i am getting which states as follows: FeatureImportanceError: Something went wrong. Importances do not sum to a positive valueThis could be due to:1) 0 or infinite divisions2) p...
0

votes
0

answer
13

Views

Any better idea to build regression model for crime data?

I am trying to understand how crime frequency affect house price in certain area. To do so, I started with Chicago crime data and zillow real estate data. I want to understand the relation between house price and crime frequency and top 5 crimes in certain areas. Initially, I build up model for this...
beyond_inifinity
0

votes
0

answer
14

Views

Use neural network to learn distribution of values for classification

Use neural network to learn distribution of values for classification The aim is to classify 1-D inputs using a neural network. There are two classes that should be classified, A and B. Each input, used to determine the class, is a number between 0.0 and 1.0. The input values for class A are evenly...
ig-dev
0

votes
0

answer
4

Views

Classification: Target with more than 2 classes

I am doing a classification exercise and facing a target with more than 2 categorical classes. I have encoded those classes using the Labelencoder. The only problem is, I believe I might have to use Onehotencoding after as I do not have only zero and 1 anymore but 0,1,2,3. The reality is, I just do...
Camue
1

votes
2

answer
2.3k

Views

How to print the order of important features in Random Forest regression using python?

I am trying out to create a Random Forest regression model on one of my datasets. I need to find the order of importance of each variable along with their names as well. I have tried few things but can't achieve what I want. Below is the sample code I tried on Boston Housing dataset: from sklearn.en...
CodeHunter
1

votes
1

answer
1.5k

Views

How to train CNN with an RGB Image

I am currently building a CNN to differentiate between a rotten apple and a normal apple. I feel that it would be of great benefit if I could feed the CNN with rgb images. However, what exactly do I need to change to the following network? x = tf.placeholder('float', [None, 784]) #y = tf.placeholder...
Rehaan Ahmad
-1

votes
0

answer
5

Views

What type of machine learning or AI Model can I use for Factor Ranking

What type of machine learning or AI Model can I use for Factor Ranking? I have some factors and am trying to rank them based on how they are able to predict in my model please what kind of machine learning or AI or Deep Learning Model work for this?
tplshams
0

votes
0

answer
4

Views

Why my classifier is unable to learn postive classes?

I'm currently performing classification, but my classifier is unable to predict postive classes on test set. The positive to negative distribution is 10:90. I did a 5 fold cross-validation using stratified sampling, the results seems to be continuous across all folds, while the in test it predicts a...
Bhaskar Dhariyal

View additional questions