Questions tagged [implementation]

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

Filter by
Sorted by
Tagged with
1 vote
2 answers
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 ...
user avatar
2 votes
0 answers
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...
user avatar
  • 121
2 votes
0 answers
99 views

How to perform pca analysis with pandas

Here is my dataset: ...
user avatar
4 votes
1 answer
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 ...
user avatar
1 vote
1 answer
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 ...
user avatar
  • 121
1 vote
0 answers
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, ...
user avatar
  • 111
1 vote
0 answers
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)...
user avatar
1 vote
1 answer
62 views

Scikit-learn's implementation of AdaBoost

I am trying to implement the AdaBoost algorithm in pure Python (or using NumPy if necessary)....
user avatar
0 votes
0 answers
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)}))$ ...
user avatar
0 votes
0 answers
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-...
user avatar
  • 143
0 votes
0 answers
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 ...
user avatar
  • 31
0 votes
1 answer
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 ...
user avatar
  • 11
2 votes
2 answers
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 ...
user avatar
0 votes
1 answer
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.
user avatar
  • 259
0 votes
2 answers
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 ...
user avatar
  • 165
1 vote
0 answers
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 ...
user avatar
  • 11
1 vote
0 answers
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 ...
user avatar
1 vote
0 answers
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 ...
user avatar
  • 11
1 vote
0 answers
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 ...
user avatar
1 vote
0 answers
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 ...
user avatar
  • 11
0 votes
0 answers
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: ...
user avatar
1 vote
1 answer
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. ...
user avatar
1 vote
0 answers
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 ...
user avatar
0 votes
1 answer
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 ...
user avatar
1 vote
0 answers
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 ...
user avatar
3 votes
1 answer
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 ...
user avatar
1 vote
0 answers
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 ...
user avatar
2 votes
0 answers
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 ...
user avatar
1 vote
0 answers
111 views

Implementation of RMS prop for linear regression

I'm trying to implement linear regression using Rms Prop optimizer from scratch. Code: ...
user avatar
0 votes
0 answers
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 ...
user avatar
  • 113
2 votes
1 answer
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,...
user avatar
  • 21
0 votes
0 answers
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 ...
user avatar
1 vote
1 answer
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 ...
user avatar
  • 11
2 votes
1 answer
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 ...
user avatar
2 votes
1 answer
69 views

Policy Gradient not "learning"

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....
user avatar
  • 853
1 vote
0 answers
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 ...
user avatar
  • 11
0 votes
1 answer
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 ...
user avatar
1 vote
0 answers
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 ...
user avatar
1 vote
0 answers
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 ...
user avatar
  • 11
1 vote
1 answer
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 ...
user avatar
  • 148
3 votes
1 answer
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, ...
user avatar
1 vote
0 answers
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 ...
user avatar
1 vote
0 answers
422 views

grad-cam implementation on mobilenet SSD network

Below is a gradcam implementation for a standard image classifier : ...
user avatar
  • 61
0 votes
1 answer
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 ...
user avatar
1 vote
1 answer
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}{...
user avatar
2 votes
1 answer
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 ...
user avatar
2 votes
1 answer
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: ...
user avatar
4 votes
2 answers
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 ...
user avatar
  • 140
3 votes
2 answers
1k views

Does the Koalas library allow to use all Pandas machine learning libraries like Scikit-Learn, XGBoost, and TensorFlow?

I would like to implement a model based on some cleaned and prepared data set. I already have a bit of experience with PySpark, but from a data scientist's perspective it can be cumbersome to work ...
user avatar
  • 165
1 vote
1 answer
87 views

Class asks me to give self for Naive Bayes Model python

I try to use the following code but when I try to use fit function with my X_train and y_train, I get the following error: <...
user avatar