6
votes
Accepted
How to define discrete action space with continuous values in OpenAI Gym?
Here is a sample environment which demonstrates this. It relies on the environment to successfully filter out the correct continuous control element
...
4
votes
Accepted
Is the denial of answering certain questions part of the machine-learned LLM, or hard-coded separately?
The efforts to add "guardrails" to LLMs is usually referred to as LLM alignment.
While the internals of ChatGPT are not known, usually LLM alignment is done at the model level via training/...
2
votes
Accepted
Does the Koalas library allow to use all Pandas machine learning libraries like Scikit-Learn, XGBoost, and TensorFlow?
Scikit-Learn, XGBoost and TensorFlow don't work with Koalas DataFrames directly. But you can use them with MlFlow. Here is an example of ML model where inference was done with Koalas:
...
2
votes
Accepted
Scikit-learn's implementation of AdaBoost
The sklearn implementation of AdaBoost takes the base learner as an input parameter, with a decision tree as the default, so it cannot modify the tree-learning ...
2
votes
Accepted
What are the main differences between uwot and umap packages in R?
I maintain the uwot package. It's an independent implementation of UMAP (although it relied strongly on me looking at the code of the "real" Python UMAP package during its development).
The ...
1
vote
1
vote
How to implement linear regression
Well there are many different ways you can improve your code. For now, You can do this to improve the model:
Try reducing the learning rate to a value like (0.00001 or 0.0001).
Your implementation ...
1
vote
Why does stochastic gradient descent lead us to a minimum at all?
For mini-batch gradient descent, the cost function may not decrease on every iteration. There is going to be some noise and smaller the batch size, noisier the process. SGD has batch size 1, so it is ...
1
vote
Implementing a model for a language to another
In case you want some state-of-the-art technique, you can implement a neural machine translation model with attention, as fully described in this course with Google members libraries like Trax.
In ...
1
vote
KNN efficient implementation
I suggest you use facebook's faiss. It is a library for similarity search, which can be used to compute kNN on large vector collections.
From facebook's own numbers:
With approximate indexing, a ...
1
vote
Accepted
1
vote
How to render environment in Tensorforce?
In case you use
https://github.com/tensorforce/tensorforce/blob/master/examples/act_observe_interface.py ,
the following modification works.
Import gym:
...
1
vote
Accepted
What should return doc.ents if the doc have no entities, in spacy?
You could just test whether the tuples entities has any elements:
for sent in list(doc.sents):
if len(sent.ents) > 0:
nb = nb+1
Edit: For the ...
1
vote
improving accuracy of logistic model
If you have a disproportionate amount of zeros, it means you models doesn't have enough data in order to learn how to correctly classify observations. Because it sees zeros almost all the time, it ...
1
vote
Representation of state space, action space and reward system for RL porblem
I would suggest you to use Deep Q or A2C (I personally use A2C). As a terminal state you can consider the state in which every tile has been visited once, except if you want to your agent wonder ...
1
vote
Linear regression : ValueError: operands could not be broadcast together with shapes (3,) (1338,)
It looks like you're trying to multiply a matrix and a vector point-wise. Such an operation is not defined. I think you should use X.dot(w), where ...
1
vote
1
vote
Does the Koalas library allow to use all Pandas machine learning libraries like Scikit-Learn, XGBoost, and TensorFlow?
I think you have misunderstood the koalas library. You can say its Pandas on Distributed System. You can use Koalas similar to pandas. There are few drawbacks with respect to APIs which is documented ...
1
vote
Why my cost function is so high?
One mistake I see is the fact that you are using the learning rate twice, one when calculating the partial derivatives and once when updating b0 and ...
1
vote
Implementation explanation for predict_proba in RandomForestClassifier- sklearn
It's explaining how the predict_proba works. If at the lowest level of the tree, you have 80 samples of class 1 and 20 samples of class 0 in a leaf. then the class probability of 1 is 80 / ( total ...
1
vote
How to do time series regression without scikit and numpy in Python?
In case you want to perform a simple time-series regression without using any packages such as Numpy etc, you need to write and solve the model yourself. You can either use gradient descent or least ...
1
vote
Linear Regression in Python using gradient descent
That could be due to many different reasons. The most important one is that your cost function might be stuck in local minima. To solve this issue, you can use a different learning rate or change your ...
1
vote
Damerau-Levenshtein Edit Distance in Python
With how old this question is, I hope you've found a working version in the meantime. For those coming along later:
There is a version known as the "restricted edit distance", meaning no sub ...
1
vote
Damerau-Levenshtein Edit Distance in Python
I have been using the following code and it has served me well so far:
...
1
vote
Accepted
T-DBSCAN - Implementing STOP logic
Just to point out a minor confusion that there seems to be in the wording: there is mixed use of the the words temporarily and temporally. [OP has since corrected this]
We really only care about the ...
1
vote
No gradients provided for any variable
It seems that you are using sorting operations like to calculate p_dist, and these kind of operations do not provide a gradient. So the error might not be in the KL ...
1
vote
No gradients provided for any variable
If you are using a default KL divergence loss, I recommend using an implemented one: tf.keras.losses.KLDivergence.
If it is the problem to use Keras from TF, implement it as they do: https://github....
1
vote
Feature scaling worsens performance?
By scaling X but not y, and having small weights at initialization, I think you are making it hard for the NN to bring the ...
1
vote
How to implement this CNN architecture in Keras
In this kind of situation, you can not use sequential API which is generally used in the architecture where you to stack layers on each other.
For this kind of problem use the functional API of keras....
1
vote
Accepted
Interpreting MLP output
This looks like a case of the model outputting the probability of being in category 1. It then is up to you to decide on the cutoff.
You give an example of an output of $(0.43, 0.56, 0.1, 0.8)$. If ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
implementation × 121python × 41
machine-learning × 32
neural-network × 27
deep-learning × 13
reinforcement-learning × 13
keras × 9
tensorflow × 9
linear-regression × 9
gradient-descent × 8
scikit-learn × 7
classification × 6
backpropagation × 6
decision-trees × 5
pytorch × 5
optimization × 5
numpy × 5
convolutional-neural-network × 4
loss-function × 4
regression × 3
dataset × 3
cnn × 3
rnn × 3
logistic-regression × 3
k-means × 3