Questions tagged [implementation]

The tag has no usage guidance, but it has a tag wiki.

111 questions
Filter by
Sorted by
Tagged with
1 vote
65 views

How to calculate true positive, true negative, false positive, negative and postive with Bayes Classifer from scratch

I am working on implementing a Naive Bayes Classification algorithm. I have a method def prob_continous_value which is supposed to return the probability density ...
• 159
166 views

Linear regression with Pytorch not converging

I am trying to perform a simple linear regression using Pytorch lightning (a network with only one neuron). The network is supposed to learn a simple function: y=-4x...
• 121
99 views

How to perform pca analysis with pandas

Here is my dataset: ...
• 159
178 views

What are the main differences between uwot and umap packages in R?

There are two packages in R that implement the UMAP algorithm for low-dimensional embedding ('uwot' and 'umap'). I've found they can give vastly different results for some datasets. For example, the ...
1 vote
52 views

Why does stochastic gradient descent lead us to a minimum at all?

Why do we think that stochastic gradient descent is going to find a minimum at all? I mean on each iteration SGD moves in the direction that reduces only current batch's error (SGD doesn't care about ...
• 121
1 vote
16 views

How exactly do you implement SGD with momentum?

I am looking up sources to implement SGD with momentum, but they are giving me different equations. (beta is the momentum hyper-parameter, ...
• 111
1 vote
27 views

Implementation of a perceptron

I want to implement a single perceptron for linear regression using the following formulas: the input data for the first case is one column (x(392, 1); y(392, 1)) and for the second case is (x(392, 7)...
• 111
1 vote
62 views

I am trying to implement the AdaBoost algorithm in pure Python (or using NumPy if necessary)....
178 views

Implementation cost function in logistic regression in python using numpy

I am implementing the cost function for logistic regression and have a question. The formulation for cost function is $J = -\frac{1}{m}\sum_{i=1}^{m}(y^{(i)}\log(a^{(i)})+(1-y^{(i)})\log(1-a^{(i)}))$ ...
10 views

Pedestrian cell-phone usage recognition

Not sure if this is the correct SE to ask this. If not, kindly refer me to the correct one. I am following this work, as well as a small number of other works on the subject. I am looking for a ready-...
• 143
25 views

Scene Graph Generation. How to choose a loss function

I am implementing a paper Graph R-CNN for Scene Graph Generation They say: For P (E|V:I), we use another binary cross-entropy loss on the relation proposals. This ...
• 31
27 views

Implementing a model for a language to another

I have a dataset of sentences of language X and Y (2 columns, for example, "abc def lang" ==> "xyz pqrt mno uages"). I want to have a output as a table that translates word by ...
• 11
113 views

KNN efficient implementation

The KNN algorithm is very handy and particularly suited to some of my problems, but I can't find any resources on how to implement it in production. As a comparative example, when I use a neural ...
15 views

Search for implementation of Faster RCNN

What are the best written and best structured Faster RCNN implementations that you know? Please provide references.
• 259
580 views

Understanding action space in stable baselines

I was trying to write reinforcement learning agent using stable-baselines3 library. The agent(abservations) method should return action. I went through different ...
• 165
1 vote
99 views

how to calculate the cosine similarity between two files?

I am using spark and scala to implement an issue. files contain phrases or sentences. I want to use domain based method to calculate the cosine similarity between tags.I convert two files into a ...
• 11
1 vote
96 views

Yolo issue with detecting positives

I've recently tried to implement a Yolo detector for traffic light detection based on yolo v1 implementation in Tensorflow/Keras. My model really struggles with detecting small objects. Loss function ...
• 92
1 vote
93 views

Extracting component means and convariances from mixture model

I am currently trying to write a simple multivariate gaussian mixture model using tensorflow probability. Specifically, I have some 2-dimensional input and 2-dimensional output data and am looking to ...
• 11
1 vote
42 views

Single layer multiple input neural network?

I am implementing single layer neural network using stochastic gradient descent. When I train the model for single input it gives the answer correctly. Now when I use the second input to update my ...
1 vote
75 views

Tensor Backpropagation

I tried to make simple neural network layers as the following, including forward and backward propagation. Here is my reference. Firstly I assume an one layer FC: $Y = X \cdot W + B$ X is input, which ...
• 11
2k views

implementing skip connection in neural nets in pytorch

I'm trying to implement skip connections in neural nets for tabular data in pytorch code: ...
1 vote
346 views

Problem with convergence of ReLu in MLP

I created neural network from scratch in python using only numpy and I'm playing with different activation functions. What I observed is quite weird and I would love to understand why this happens. ...
1 vote
182 views

How to choose initial theta in simple linear regression?

I have the sales of items from January 2013 to October 2015. I just want to predict the total sales for the next month. Just for the sake of learning, I would like to transform it into a multiple ...
66 views

Correctness of a ROC Curve

I've built a Decision Tree Classifier to practice with the sklearn library. My first task was to shuffle the iris dataset and split it keeping only the last 10 elements for the test. Then, after the ...
1 vote
75 views

how weighted log loss works

I have seen this in a kaggle notebook. I understand we add some weight to classes. what I don't understand is how those weights are generated. below is the code. Can you explain why it's useful and ...
64 views

Issues with self-implemented logistic regression

I am trying to self-implement a logistic regression algorithm to do some self-learning but I am having a bit of trouble with achieving similar accuracy to the logistic regression of sklearn. Here is ...
1 vote
461 views

Calculate the number of TP, FP, FN for the object detection task with many classes

I am trying to count the number of True Positives (TP), False Positives (FP), and False Negatives (FN) for object detection task with two classes. I assumed that: TP - is the detection with ...
• 111
24 views

Reference implementation of q-learning in Python

I'm a machine learning newbie, trying to learn Q-learning. I read a few texts and I get the general gist, but what I'd really love to see is a simple example of a Q-learning algorithm in Python that I ...
• 161
1 vote
111 views

Implementation of RMS prop for linear regression

I'm trying to implement linear regression using Rms Prop optimizer from scratch. Code: ...
• 117
72 views

Calculating error in each layer of neural network

I am referring Andrew Ng's course to implement neural network https://www.youtube.com/watch?v=x_Eamf8MHwU&t. In this course bias is taken single matrix with weights. I got a error and I am not ...
• 113
62 views

how to find the best parameters to solve a differential equation? [closed]

I have a differential equation: def func(Y, t, r, p, K, alpha): return r * (Y ** p) * (1 - (Y / K) ** alpha) and I want to find the best parameters that fit (r,...
• 21
28 views

Example of Reverse KL Divergence in Supervised Learning

It is of common knowledge that Supervised Learning uses forward KL divergence. However, I would like to use Reverse KL Divergence and am looking for examples of similar usage in literature. Most ...
1 vote
523 views

Naive Bayes always predicting the same label

I have been trying to write a naive bayes classifier from scratch that is supposed to predict the class label of the nominal car.arff dataset. However the classifier always predicts the most common ...
• 11
3k views

Hidden Markov Model: Forward Algorithm implementation in Python

I am learning Hidden Markov Model and its implementation for Stock Price Prediction. I am trying to implement the Forward Algorithm according to this paper. Here I found an implementation of the ...
• 143
69 views

I'm attempting to implement the policy gradient taken from the "Hands-On Machine Learning" book by Geron, which can be found here. The notebook uses Tensorflow and I'm attempting to do it with PyTorch....
• 853
1 vote
31 views

Implementing neural Network using caltech course

I am trying to implement neural network using numpy using this lecture https://www.youtube.com/watch?v=Ih5Mr93E-2c&list=PLD63A284B7615313A&index=10 at timestamp 59:40. In this lecture there ...
• 11
377 views

How to render environment in Tensorforce?

How can one render the environment using the Tensorforce library? I've tried calling environment.render, but it says that the function does not exist. This is my ...
• 157
1 vote
448 views

Does OpenAI Gym or Tensorforce require a normalized action space?

I am learning to use OpenAI Gym to make a custom environment with continuous action and observation spaces and apply reinforcement learning algorithms using the Tensorforce library. The problem is ...
• 157
1 vote
45 views

How to Split Continuous Labelled Data?

I've started studying decision trees, and I noticed that the examples online used categorical features to split the data at each node. I'm working on data sets with a binary classification output and ...
• 11
1 vote
36 views

Displaying network error as a single value

I've been writing a neural network from scratch. I've completed the feedforward, backpropagation, and mini-batch gradient descent methods, so I can train the network. Other neural networks I've worked ...
• 148
7k views

How to define discrete action space with continuous values in OpenAI Gym?

I am trying to use a reinforcement learning solution in an OpenAI Gym environment that has 6 discrete actions with continuous values, e.g. increase parameter 1 with 2.2, decrease parameter 1 with 1.6, ...
• 157
1 vote
100 views

Firebase AB testing algorithm

We have run an AB test at firebase which has the following results: I was also building my own Bayesian AB-test suite and was wondering how they came to these conclusions. What I was doing was ...
1 vote
422 views

grad-cam implementation on mobilenet SSD network

Below is a gradcam implementation for a standard image classifier : ...
• 61
405 views

What should return doc.ents if the doc have no entities, in spacy?

I want to answer this question: "How many sentences contain named entities given a doc?" and I have this piece of code as solution ...
1 vote
82 views

improving accuracy of logistic model

I am trying to reproduce results from one paper, where authors minimized the following loss function \begin{align} \min_{w \in R^d} \frac{1}{n} \sum_{i \in [n]} log(1 + exp(-y_ix_i^Tw))+\frac{\lambda}{...
236 views

Representation of state space, action space and reward system for RL porblem

I am trying to solve the problem of an agent dynamically discovering(start with no information about the environment) the environment and to explore as much of the environment as possible without ...
958 views

Linear regression : ValueError: operands could not be broadcast together with shapes (3,) (1338,)

I try to use linear regression for insurance data . But had error on the when try to call a function with features parameter. Here is my code: ...
• 141
1k views

RNN in pseudo-code

A few years ago, I understood the classical MLP neural network much better when I wrote an implementation from scratch (using only Python + Numpy, without using tensorflow). Now I'd like to do the ...
• 140