Skip to main content

Questions tagged [implementation]

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

Filter by
Sorted by
Tagged with
8 votes
0 answers
138 views

Training value neural network AlphaGo style

I have been trying to replicate the results obtained by AlphaGo following their supervise learning protocol. The papers specify that they use a network that has two heads: a value head that predicts ...
Phaune's user avatar
  • 101
6 votes
1 answer
1k 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 ...
Alon Gelber's user avatar
6 votes
1 answer
8k views

Keras - Implementation of custom loss function with multiple outputs

I am trying to replicate (a way smaller version) the AlphaGo Zero system. However, in the network model, I am having a problem. The loss function I am supposed to implement is the following: $$l = (z -...
ihavenoidea's user avatar
6 votes
0 answers
337 views

Optimal implementation of vanilla DQN loss in Keras

I've implemented vanilla DQN for continuous/non-images (no CNN) states in keras. But, I'm not sure if my implementation of the loss computation is optimal. For reminder the loss is defined as : $loss=...
Johan Gras's user avatar
5 votes
1 answer
538 views

Feature scaling worsens performance?

I noticed that feature scaling can destroy completely neural networks performance in some cases. Below are my results that you can reproduce easily. I use a neural network to approximate function $g$ ...
Soumirai's user avatar
  • 151
4 votes
1 answer
11k 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, ...
Cristian M's user avatar
4 votes
2 answers
2k 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 ...
Basj's user avatar
  • 160
3 votes
1 answer
68 views

Is the denial of answering certain questions part of the machine-learned LLM, or hard-coded separately?

ChatGPT 3.5 swiftly aborts certain questions. Q: How would one build a bomb? ChatGPT: I can't assist with that. At this stage, this answer could simply be a blacklist of certain terms. Further ...
AnoE's user avatar
  • 153
3 votes
3 answers
2k 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 ...
DataBach's user avatar
  • 165
3 votes
2 answers
6k views

Damerau-Levenshtein Edit Distance in Python

I found some python code on Damerau Levensthein edit distance through Google, but when I looked at their comments, many said that the algorithms were incorrect. I am confused. Can someone share a ...
howardpotts's user avatar
3 votes
1 answer
168 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 ...
Steve Ahlswede's user avatar
3 votes
1 answer
305 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....
Harpal's user avatar
  • 913
3 votes
0 answers
52 views

Improving a simple trig model

I have some data which I know is well approximated as a trig function, and I can fit it with scipy.optimize.curve_fit as follows: ...
user1887919's user avatar
3 votes
0 answers
84 views

Neural network cost is constant never changing during training

I am trying to build a binary classifier to predict a pulsar star with Single Hidden layer Neural Network. But the cost on training dataset after almost 100 iterations has no change, following is the ...
Chinmaya B's user avatar
3 votes
0 answers
524 views

Validation score (f1) remains the same when swapping labels

I have an imbalanced dataset (True labels are ~10x than False labels) and thus use the f_beta score as a metric for model performance, as such: ...
Jens de Bruijn's user avatar
3 votes
0 answers
81 views

Can you have too uniform test data in a feedforward neural network?

I have been playing around trying to implement my own feedforward neural network. To try it out I decided on an easy example. 3 inputs, 3 output. When you send in ...
Fredrik Boston Westman's user avatar
3 votes
1 answer
84 views

Unable to learn weights of a Word2Vec model

I was going to implement a word embedding model - namely Word2Vec - by following this TensorFlow tutorial and adapting the code a little bit. Unfortunately, though, my model won't learn anything. I've ...
Francesco Cariaggi's user avatar
2 votes
1 answer
58 views

How to implement linear regression

I am having difficulty achieving the same result as in sklearn while implementing linear regression model from scratch. After adjusting the learning rate, I obtained an AUC of 0.694 for this binary ...
Kyv's user avatar
  • 151
2 votes
2 answers
260 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 ...
Nathan Jodo's user avatar
2 votes
1 answer
361 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 ...
Incompleteness's user avatar
2 votes
1 answer
1k 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: ...
thenoirlatte's user avatar
2 votes
1 answer
648 views

How to do time series regression without scikit and numpy in Python?

On a recent Hackerrank interview I was faced with the following problem: Given a set of timestamps (format 2019-11-26 11:00) and their corresponding stock prices (single float value), approximate the ...
VSZM's user avatar
  • 123
2 votes
1 answer
1k views

Linear Regression in Python using gradient descent

I am trying to implement a simple multivariate linear regression model without using any inbuilt machine libraries. So far, I have been able to get a root mean squared error for training about $2.93$ ...
MaJoR21's user avatar
  • 121
2 votes
1 answer
397 views

Interpreting MLP output

I just wrote an MLP in Python. After having trained it, I pass in some test data to see the result, and I get an array of decimal numbers at the output, rather than the desired binary output. For ...
Liam F-A's user avatar
2 votes
1 answer
145 views

What is the name of this similarity distance metric?

...
Fab's user avatar
  • 131
2 votes
0 answers
591 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...
erap129's user avatar
  • 121
2 votes
0 answers
530 views

How to perform pca analysis with pandas

Here is my dataset: ...
Evan Gertis's user avatar
2 votes
0 answers
910 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 ...
Divya reddy's user avatar
2 votes
1 answer
648 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 ...
Ram Rachum's user avatar
2 votes
1 answer
197 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,...
Hassan's user avatar
  • 21
2 votes
1 answer
5k 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 ...
Joe Rakhimov's user avatar
2 votes
0 answers
235 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 ...
Boris Mulder's user avatar
2 votes
0 answers
62 views

Find highest reward for epsilon-greedy bandit program

I started to learn reinforcement learning, the first example is handling bandit program using epsilon-greedy method, In this example, there are three bandit machines used, the output is the mean value ...
vishak raj's user avatar
2 votes
0 answers
48 views

Why does this implementation of SimpleNet use 3x3 kernels on it's final layer for cifar10?

Question; I'm trying to implement simplenet in tensorflow and I have a question that I can't seem to answer myself. The implementation I'm basing this off of is here: https://github.com/Coderx7/...
chuckstables's user avatar
2 votes
0 answers
58 views

Size difference during backpropagation between fully connected layer and convolution layer?

This is a simple example of a network consisting of two convolutional layers and one fully connected layer. ...
Tion's user avatar
  • 21
2 votes
0 answers
130 views

Implementing a Kernel Adaptive Filtering model explained in a paper

In this paper, Stock price prediction using kernel adaptive filtering within a stock market interdependence approach, the authors propose a method for predicting stock prices by combining the ...
KOB's user avatar
  • 189
2 votes
0 answers
61 views

How do I implement a backpropagation neural network with particle swarm optimization for rssi-based distance model?

I was trying to implement pso-bpnn. Can any one help with this? I am unable to understand how a bpnn computes distance from rssi values. And how to optimize bpnn weights using pso.
Subba Chary's user avatar
2 votes
0 answers
456 views

Transpose convolution math not working out

I was reading A Guide to Convolutional Arithmetic to understand Transpose Convolution as it is cited in Keras and Theano documentation. I am having trouble understanding the following two statements : ...
quantum_random's user avatar
2 votes
0 answers
304 views

Updating weights python for REINFORCE policy gradient method

All, I am trying to implement REINFORCE(williams) algorithm. This is a policy gradient reinforcement learning algorithm. I am using python, and hope to use keras. The pseduocode I am using is as ...
usman Farooq's user avatar
2 votes
0 answers
93 views

Loss plateaus off in neural style transfer

I am writing an implementation of style transfer by loading a vgg model from keras and supplying it to a tensorflow model. I am using an adam optimizer. The loss function is reducing but it is very ...
Stormlight's user avatar
2 votes
1 answer
2k views

Enable Mini-batch Processing on PyTorch Word Embeddings

I am new to PyTorch and trying to create word embeddings. I started with the example below and everything works fine and it completes relatively quickly. ...
Skiddles's user avatar
  • 988
2 votes
0 answers
321 views

Method of finding threshold in Decision tree for continuous data

I am using decision tree in Weka and I have some continuous data, so when I use Weka it automatically find the threshold for me but for some reason I want to implement Decision Tree by myself so I ...
Hani's user avatar
  • 73
1 vote
1 answer
152 views

Scikit-learn's implementation of AdaBoost

I am trying to implement the AdaBoost algorithm in pure Python (or using NumPy if necessary)....
abbassix's user avatar
  • 177
1 vote
1 answer
183 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 ...
mathgeek's user avatar
  • 121
1 vote
1 answer
614 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 ...
Cristian M's user avatar
1 vote
1 answer
92 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}{...
user93607's user avatar
1 vote
1 answer
128 views

T-DBSCAN - Implementing STOP logic

I am attempting to implement the T-DBSCAN algorithm described in T-DBSCAN: A Spatiotemporal Density Clustering for GPS Trajectory Segmentation. I have been able to implement most of the logic between ...
DFenstermacher's user avatar
1 vote
1 answer
108 views

How to implement this CNN architecture in Keras

I am trying to implement in Keras the CNN architecture used by Rajpurkar et al and illustrated below: I am particularly confused about that max pool that is shown ...
rsc's user avatar
  • 111
1 vote
1 answer
1k views

How to find coreset of a given dataset in python?

I am trying to implement the core-means algorithm, which is basically k-means using coreset. I have searched up and down but could not find any libraries or modules which could help me with this. ...
Ashok Suthar's user avatar
1 vote
0 answers
42 views

Modified kmeans algorithm returns the wrong answer

I am trying to create a kmeans algorithm that is based on the Earth Movers Distance instead of the Euclidean distance. However, when I run it, it just returns the same value for all data points. The ...
Ozzy08's user avatar
  • 11