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
I was debugging a problem where the user wanted to apply PCA to separate test data. The problem happens because creating features with the same names as in original data replaces features in the Variable._all_vars dictionary, which makes newly loaded data incompatible with previously built transformations. See the following:
importOrangedata=Orange.data.Table("iris")
pca=Orange.projection.PCA()(data)(data)
print("Original feature id", id(data.domain.attributes[0]))
print("PCA transform", data.transform(pca.domain)[0])
# we create variables with the same namesnf= [Orange.data.ContinuousVariable(a.name) foraindata.domain.attributes]
print("New feature id", id(nf[0]))
# the new data uses variables from nf, hence the transformation won't workdata=Orange.data.Table("iris")
print("Loaded feature id", id(data.domain.attributes[0]))
print(data.transform(pca.domain)[0])
print("PCA transform", data.transform(pca.domain)[0]) # all zeros
There may be many hidden bugs stemming from this. Is there any case when we would not want to use Variable.make functionality by default?
The text was updated successfully, but these errors were encountered:
Maybe. Let's say we have a variable gender and give it values F and M. Next we have a new data set with variable gender and values 0 and 1. You want to have a new variable, not a single variable with values F, M, 0 and 1. (Which is a very bad example of what we'd like to avoid, because the file widget will currently does exactly this. :()
@astaric had a good idea regarding make and reuse, but I forgot it; I hope he has better memory than me.
I was debugging a problem where the user wanted to apply PCA to separate test data. The problem happens because creating features with the same names as in original data replaces features in the Variable._all_vars dictionary, which makes newly loaded data incompatible with previously built transformations. See the following:
There may be many hidden bugs stemming from this. Is there any case when we would not want to use Variable.make functionality by default?
The text was updated successfully, but these errors were encountered: