What is best optimizer for Classify images of clothing [closed] - python

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 1 year ago.
Improve this question
I try to use Keras library in python. Definitely this example https://www.tensorflow.org/tutorials/keras/classification.
What is best loss,hyper parameters and optimizer for this example?

You can look up any standard example such as MNIST classification for reference.
Usually for classification cross entropy loss is used. The optimizer is subjective and depends on the problem. SGD and Adam are common.
For LR you can start with 10^(-3) and keep reducing if the validation loss doesn't decrease after a certain number of iterations.

Related

How close does my testing accuracy need to be to my training accuracy for ML model [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 months ago.
Improve this question
I've built a Random Forrest ML model. My train accuracy is around 97% and my test accuracy is around 85%.
Is this normal or is this too big of a difference? I know there is probably overfitting, but if the test accuracy is high at 85%, does it matter?
Thank you.
check performance by using cross validation. cross validation helps you see how your model will perform with new data.
https://stats.stackexchange.com/questions/111968/random-forest-how-to-handle-overfitting
check your model for overfitting using mean squared error (regressor)
https://mljar.com/blog/random-forest-overfitting/
check for model overfitting with a (classifier)
How do I solve overfitting in random forest of Python sklearn?

Tensorflow - What is the reason of difference between train size and trained values [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have an excel file with 1000 different values, I am trying to train my artificial intelligence with these values. While the Test Size is 0.33, artificial intelligence should be trained with 670 values, but only 21 values ​​are trained. What is the source of the problem?
You probably mean a number of batches trained using fit. Every batch comprises 32 items by default

How many words are lmmatized? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
In a data frame with 1000 texts, after doing preprocessing lemmatization, how can I find out how many words have been lemmatized in each text?
Why did you run your model for just 3 epochs? I would suggest you to run it for about 20 epochs, and then see if the validation accuracy is not reducing. And the thing, I can tell you is that You need to change your this line of code:
model.add(Embedding(300000,60,input_length=300))
To this:
model.add(Embedding(k, 60,input_length=300))
Where you can set k as 256 or 512 or a number close to them. But 300000 would be just too much. By that, your network would focus more on the embedding layer, when the main job is of encoder and decoder.
Another thing, you should increase your LSTM units (maybe to a number like 128 or 256) in both encoder and decoder, and remove the recurrent_dropout parameter (since, you are dropping out using the dropout layer after encoder). If that still doesn't help then you can even add Batch Normalization layers to your model.

tf-agent, QNetwork => DqnAgent w/ tfa.optimizers.CyclicalLearningRate [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Is there an easy native way to implement tfa.optimizers.CyclicalLearningRate w/ QNetwork on DqnAgent?
Trying to avoid writing my own DqnAgent.
I guess the better question might be, what is a proper way to implement callbacks on DqnAgent?
From the tutorial you linked, the part where they set the optimizer is
optimizer = tf.compat.v1.train.AdamOptimizer(learning_rate=learning_rate)
train_step_counter = tf.Variable(0)
agent = dqn_agent.DqnAgent(
train_env.time_step_spec(),
train_env.action_spec(),
q_network=q_net,
optimizer=optimizer,
td_errors_loss_fn=common.element_wise_squared_loss,
train_step_counter=train_step_counter)
agent.initialize()
So you can replace optimizer with whatever optimizer you would rather use. Based on the documentation something like
optimizer = tf.keras.optimizers.Adam(learning_rate=tfa.optimizers.CyclicalLearningRate)
should work, barring any potential compatibility issues coming from that they are using the tf 1.0 adam in the tutorial.

How can train and predict models with custom data? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I have 2 arrays, one with sizes and one with prices. How can I train or predict or use a cost function (i'm a begginner yeah) so i can predict prices according to a random size?
Maybe i'm confused with the terms but I hope someone can understand. thanks.
You must use a regressor and fit it to your data. Once fitted, you can use this regressor to predict unseen samples.
Here is a link that shows all the regressors available on sklearn.
Amongst the regressors you could use I can cite : OLS, Ridge, K-NN, Decision trees, Random Forest ...
The documentation is very clear so you won't find (a priori) any difficulty.
NB :
A training dataset with 14 elements is clearly not sufficient.
Try to find out other samples to add to your dataset.

Categories

Resources