-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request for a «set_TA_action” method #46
Comments
The “set_weight” method is already available. Sorry I hadn't noticed. |
The set_TA_action and set_weight methods work fine. However, it seems one has to perform training of the TM (in my case the TMCoalescedClassifier) before the methods can be applied. This is possibly difficult to avoid. If that is the case, one can perform only a short training phase (with only a few samples) only to get all the clause_banks etc. defined, before one "loads" an existing model to the TM. |
Currently, we need to run .fit before the model is initialized. What do you think? |
It absolutely makes sense to add shape. What is extracted from the data is simply the number of features and the number of classes, which is needed to set up the data structures |
The following code example seems to work well back and forth, and utilizes .csv model files. Here I do not use the TA_action_data when loading a model, just the TA_state_data. I am sure there can be more elegant ways to implement things, but this is something that is easy to understand and use. If a model can be loaded without performing the fit method first, this can be time saving for various experiments. #################################################### numberofclasses = 10 TA_action_array= np.zeros((numberofclauses, numberofliterals), int) for k in range (numberofclauses): weightarray=np.zeros((numberofclasses, numberofclauses), int) #SAVE MODEL: #LOAD MODEL: for k in range (numberofclauses): for g in range (numberofclasses): |
For the TMCoalescedClassifier I have used the following code to extract TA_actions per clause and weights per clause (per class).
TA_action_array= np.zeros((numberofclauses, numberofliterals), int)
for k in range (numberofclauses):
for b in range (numberofliterals):
if tm.get_ta_action(k,b) == True:
TA_action_array[k,b]=1
Weightarray=np.zeros((numberofclasses, numberofclauses), int)
for g in range (numberofclasses):
for c in range (numberofclauses):
Weightarray[g,c]=tm.get_weight(g,c)
I have used this just for extracting a trained model from the TMU – for use on hardware implementations of the TMCoalescedClassifier.
It would be great if a “set_TA_action” method could be included for the TMU, so it would be possible to manually set individual TA_actions. There is a “set_TA_state” method available, and this can be used. However, one then needs to know the number of TA states. A “set_TA_action” method would be simpler to use, and could potentially be implemented by using the “set_TA_state” to set the TA state either in N (exclude) or N+1 (include).
Furthermore, it would be great if a “set_weight” method could be included so it would be possible to manually explore the influence on individual weights.
This issue is also related to Issue #43.
The text was updated successfully, but these errors were encountered: