Skip to main content
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 ...
chappers's user avatar
  • 261
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/...
noe's user avatar
  • 27.2k
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: ...
illuminato's user avatar
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 ...
Ben Reiniger's user avatar
  • 12k
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 ...
James Melville's user avatar
1 vote

Low Precision of LeakyReLU

The alpha parameter is float32. ...
Karl's user avatar
  • 826
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 ...
Vic's user avatar
  • 306
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 ...
serali's user avatar
  • 1,252
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 ...
German C M's user avatar
  • 2,724
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 ...
noe's user avatar
  • 27.2k
1 vote
Accepted

Correctness of a ROC Curve

The first issue seems to be in the following block of code: ...
Oliver Foster's user avatar
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: ...
rondelion's user avatar
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 ...
Windowlicker's user avatar
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 ...
Leevo's user avatar
  • 6,315
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 ...
Constantinos's user avatar
  • 2,121
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 ...
Michał Słodki's user avatar
1 vote

RNN in pseudo-code

Simple RNN Cells follow this pattern: ...
Leevo's user avatar
  • 6,315
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 ...
Syenix's user avatar
  • 359
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 ...
Oxbowerce's user avatar
  • 8,027
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 ...
Blenz's user avatar
  • 2,094
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 ...
Peter's user avatar
  • 7,586
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 ...
nimar's user avatar
  • 758
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 ...
hlongmore's user avatar
  • 113
1 vote

Damerau-Levenshtein Edit Distance in Python

I have been using the following code and it has served me well so far: ...
Fnguyen's user avatar
  • 1,743
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 ...
n1k31t4's user avatar
  • 15k
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 ...
maksym33's user avatar
  • 146
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....
Antonio Jurić's user avatar
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 ...
Ben Reiniger's user avatar
  • 12k
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....
Swapnil Pote's user avatar
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 ...
Dave's user avatar
  • 4,044

Only top scored, non community-wiki answers of a minimum length are eligible