Questions tagged [machine-learning]

Implementation questions about machine learning algorithms. General questions about machine learning (concepts, theory, methodology, terminology, etc.) should be posted to their specific communities.

Machine learning revolves around developing self-learning computer algorithms that function by virtue of discovering patterns in data and making intelligent decisions based on such patterns.

Machine learning is a subfield of computer science that evolved from the study of pattern recognition and computational learning theory in artificial intelligence. Machine learning explores the construction and study of algorithms that can learn from and make predictions about data. Such algorithms operate by building a model from example inputs in order to make data-driven predictions or decisions rather than following strictly static program instructions.

NOTE: If you want to use this tag for a question not directly concerning implementation, then consider posting on Cross Validated, Data Science, or Artificial Intelligence instead; otherwise you're probably off-topic. Please choose one site only and do not cross-post to more than one - see Is cross-posting a question on multiple Stack Exchange sites permitted if the question is on-topic for each site? (tl;dr: no).

Classic Problems:

Relevant Algorithms:

Applications:

Software:

Related-tags:

Video Lectures:-

55241 questions
117
votes
10 answers

keras: how to save the training history attribute of the history object

In Keras, we can return the output of model.fit to a history as follows: history = model.fit(X_train, y_train, batch_size=batch_size, nb_epoch=nb_epoch, validation_data=(X_test,…
jwm
  • 4,832
  • 10
  • 46
  • 78
117
votes
8 answers

How to apply gradient clipping in TensorFlow?

Considering the example code. I would like to know How to apply gradient clipping on this network on the RNN where there is a possibility of exploding gradients. tf.clip_by_value(t, clip_value_min, clip_value_max, name=None) This is an example that…
Arsenal Fanatic
  • 3,663
  • 6
  • 38
  • 53
117
votes
3 answers

word2vec: negative sampling (in layman term)?

I'm reading the paper below and I have some trouble , understanding the concept of negative sampling. http://arxiv.org/pdf/1402.3722v1.pdf Can anyone help , please?
Andy K
  • 4,944
  • 10
  • 53
  • 82
116
votes
2 answers

What is the role of TimeDistributed layer in Keras?

I am trying to grasp what TimeDistributed wrapper does in Keras. I get that TimeDistributed "applies a layer to every temporal slice of an input." But I did some experiment and got the results that I cannot understand. In short, in connection to…
Buomsoo Kim
  • 1,283
  • 2
  • 9
  • 5
116
votes
11 answers

Error in Python script "Expected 2D array, got 1D array instead:"?

I'm following this tutorial to make this ML prediction: import numpy as np import matplotlib.pyplot as plt from matplotlib import style style.use("ggplot") from sklearn import svm x = [1, 5, 1.5, 8, 1, 9] y = [2, 8, 1.8, 8, 0.6,…
JonTargaryen
  • 1,317
  • 3
  • 11
  • 18
115
votes
4 answers

ConvergenceWarning: lbfgs failed to converge (status=1): STOP: TOTAL NO. of ITERATIONS REACHED LIMIT

I have a dataset consisting of both numeric and categorical data and I want to predict adverse outcomes for patients based on their medical characteristics. I defined a prediction pipeline for my dataset like so: X =…
sums22
  • 1,793
  • 3
  • 13
  • 25
115
votes
3 answers

What is cross-entropy?

I know that there are a lot of explanations of what cross-entropy is, but I'm still confused. Is it only a method to describe the loss function? Can we use gradient descent algorithm to find the minimum using the loss function?
theateist
  • 13,879
  • 17
  • 69
  • 109
114
votes
6 answers

What is the mAP metric and how is it calculated?

In Computer Vision and Object Detection, a common evaluation method is mAP. What is it and how is it calculated?
cerebrou
  • 5,353
  • 15
  • 48
  • 80
114
votes
4 answers

multi-layer perceptron (MLP) architecture: criteria for choosing number of hidden layers and size of the hidden layer?

If we have 10 eigenvectors then we can have 10 neural nodes in input layer.If we have 5 output classes then we can have 5 nodes in output layer.But what is the criteria for choosing number of hidden layer in a MLP and how many neural nodes in 1…
113
votes
6 answers

scikit-learn .predict() default threshold

I'm working on a classification problem with unbalanced classes (5% 1's). I want to predict the class, not the probability. In a binary classification problem, is scikit's classifier.predict() using 0.5 by default? If it doesn't, what's the default…
ADJ
  • 4,892
  • 10
  • 50
  • 83
112
votes
6 answers

Python: tf-idf-cosine: to find document similarity

I was following a tutorial which was available at Part 1 & Part 2. Unfortunately the author didn't have the time for the final section which involved using cosine similarity to actually find the distance between two documents. I followed the…
add-semi-colons
  • 18,094
  • 55
  • 145
  • 232
111
votes
8 answers

Accuracy Score ValueError: Can't Handle mix of binary and continuous target

I'm using linear_model.LinearRegression from scikit-learn as a predictive model. It works and it's perfect. I have a problem to evaluate the predicted results using the accuracy_score metric. This is my true Data : array([1, 1, 0, 0, 0, 0, 1, 1, 0,…
110
votes
4 answers

What's the difference between torch.stack() and torch.cat() functions?

OpenAI's REINFORCE and actor-critic example for reinforcement learning has the following code: REINFORCE: policy_loss = torch.cat(policy_loss).sum() actor-critic: loss = torch.stack(policy_losses).sum() + torch.stack(value_losses).sum() One is…
Gulzar
  • 23,452
  • 27
  • 113
  • 201
108
votes
3 answers

Extract upper or lower triangular part of a numpy matrix

I have a matrix A and I want 2 matrices U and L such that U contains the upper triangular elements of A (all elements above and not including diagonal) and similarly for L(all elements below and not including diagonal). Is there a numpy method to do…
pratikm
  • 4,034
  • 7
  • 25
  • 23
104
votes
6 answers

How to get Tensorflow tensor dimensions (shape) as int values?

Suppose I have a Tensorflow tensor. How do I get the dimensions (shape) of the tensor as integer values? I know there are two methods, tensor.get_shape() and tf.shape(tensor), but I can't get the shape values as integer int32 values. For example,…