You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, when using the code to learn shapelets on time series, I got stucked inside a while loop as follow, which inside the class "CrossEntropyLearningShapelets". I found loss_iteration will be a fixed number after several rounds in the loop. I provide a quick but not that feasible solution to jump out the infinite loop as follow, which examine if loss at last round is equal to loss_iteration (i.e. loss at current round), and it will leave and continue next learning if it is.
I think the more great solution is using adaptive gradient approach to learn, but it might not the same as the author did in their paper.
Steps/Code to Reproduce
# If loss is increasing, decrease the learning ratelast_loss=Noneiflosses[-1] <loss_iteration:
whilelosses[-1] <loss_iteration:
""" Note : Since source code might stuck in this while loop We should stop stucking after loss never change at this round. """iflast_loss==loss_iteration:
break# Go back to previous stateweights+=learning_rate*gradient_weightsshapelets_array=_reshape_array_shapelets(
shapelets, lengths)
shapelets_array+=learning_rate*gradient_shapeletsshapelets=tuple(
_reshape_list_shapelets(shapelets_array, lengths))
# Update learning ratelearning_rate/=5# Recompute shapelet gradientweights-=learning_rate*gradient_weightsgradient_shapelets=_grad_shapelets(
X, y_ind, n_classes, weights, shapelets, lengths,
self.alpha, self.penalty, self.C, self.fit_intercept,
self.intercept_scaling, sample_weight
)
shapelets_array=_reshape_array_shapelets(
shapelets, lengths)
shapelets_array-=learning_rate*gradient_shapeletsshapelets=tuple(
_reshape_list_shapelets(shapelets_array, lengths))
last_loss=loss_iterationloss_iteration=_loss(
X, y_ind, n_classes, weights, shapelets, lengths,
self.alpha, self.penalty, self.C, self.fit_intercept,
self.intercept_scaling, sample_weight
)
Versions
The text was updated successfully, but these errors were encountered:
Description
Hi, when using the code to learn shapelets on time series, I got stucked inside a while loop as follow, which inside the class "CrossEntropyLearningShapelets". I found loss_iteration will be a fixed number after several rounds in the loop. I provide a quick but not that feasible solution to jump out the infinite loop as follow, which examine if loss at last round is equal to loss_iteration (i.e. loss at current round), and it will leave and continue next learning if it is.
I think the more great solution is using adaptive gradient approach to learn, but it might not the same as the author did in their paper.
Steps/Code to Reproduce
Versions
The text was updated successfully, but these errors were encountered: