hi, > I am trying to make the K-SVD implementation consistent with the existing > sparse coding algorigthms (dict_learning and orthogonal_mp) and I am a bit > confused by the notations. I'll give a summary of the notations and explain > what I am not understanding. > > 1) sklearn.decomposition.dict_learning > > Problem: X ~ CD, where > X : (n_samples, n_features) - training samples (as rows); > D : (n_components, n_features) - dictionary; > C : (n_samples, n_components) - sparse codes. > > In the sparse coding papers the common notation is the following: X ~ DC, > where > X : (n_features_1, n_samples) - training samples (as columns); > D : (n_features_1, n_features_2) - dictionary; > C : (n_features_2, n_samples) - sparse codes. > > If I understand correctly, the training samples are placed as rows for the > consistency with the rest of the library and machine learning papers' > notation. So all the matrices are just transposed and everything is ok.
yes > 2) sklearn.linear_model.orthogonal_mp > > Problem: y ~ Xc, where > y : (n_samples,) - the input vector; > X : (n_samples, n_features) - dictionary; > c : (n_features,) - the sparse code. > > Sparse coding papers notation: y ~ Xc, where > y : (n_features_1,) - the input vector; > X : (n_features_1, n_features_2) - dictionary; > c : (n_features_2,) - the sparse code. > > To the contrary to the dict_learning function the matrices are not > transposed and the input vector is a column. Additionaly, the same entity > (features_1) is named differently in dict_learning (features) and > orthogonal_mp (samples). yes it's expected. orthogonal_mp is a standard regression model so X is n_samples, n_features. my advise is transpose the matrices as needed to keep the same API as dictionary learning code. A ------------------------------------------------------------------------------ Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer http://pubads.g.doubleclick.net/gampad/clk?id=154622311&iu=/4140/ostg.clktrk _______________________________________________ Scikit-learn-general mailing list Scikit-learn-general@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/scikit-learn-general