{"action":"created","issue":{"url":"https://api.github.com/repos/menpo/menpo/issues/626","labels_url":"https://api.github.com/repos/menpo/menpo/issues/626/labels{/name}","comments_url":"https://api.github.com/repos/menpo/menpo/issues/626/comments","events_url":"https://api.github.com/repos/menpo/menpo/issues/626/events","html_url":"https://github.com/menpo/menpo/issues/626","id":103531785,"number":626,"title":"PCAModel only accepts Vectorizable instances","user":{"login":"patricksnape","id":708474,"avatar_url":"https://avatars.githubusercontent.com/u/708474?v=3","gravatar_id":"","url":"https://api.github.com/users/patricksnape","html_url":"https://github.com/patricksnape","followers_url":"https://api.github.com/users/patricksnape/followers","following_url":"https://api.github.com/users/patricksnape/following{/other_user}","gists_url":"https://api.github.com/users/patricksnape/gists{/gist_id}","starred_url":"https://api.github.com/users/patricksnape/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patricksnape/subscriptions","organizations_url":"https://api.github.com/users/patricksnape/orgs","repos_url":"https://api.github.com/users/patricksnape/repos","events_url":"https://api.github.com/users/patricksnape/events{/privacy}","received_events_url":"https://api.github.com/users/patricksnape/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/menpo/menpo/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/menpo/menpo/labels/Intermediate","name":"Intermediate","color":"eb6420"},{"url":"https://api.github.com/repos/menpo/menpo/labels/Python","name":"Python","color":"5319e7"},{"url":"https://api.github.com/repos/menpo/menpo/labels/question","name":"question","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-08-27T15:09:01Z","updated_at":"2015-09-01T09:32:47Z","closed_at":null,"body":"At the moment, `PCAModel` can only accept lists of `Vectorizable` types. However, if you want to perform PCA on a list of numpy arrays, say, this is not possible. The major issue with this is that, in MenpoFit, if you have a feature that is simply a vector (SIFT -> `128x1`), you cannot currently perform PCA on it due to our `Vectorizable` requirement.\r\n\r\nHowever, this is a sensible restriction at the moment because there are a load of methods such as `instance` that require the `from_vector` functionality.\r\n\r\nPossible Solutions\r\n------------------------\r\n\r\n  1. Create a dummy `Vector` or `VectorizableWrapper` class that provides `as_vector` and `from_vector`\r\n      - **Pros**: Simple to implement - No changes to `PCAModel`\r\n      - **Cons**: How do we detect this for `PCAModel`? Does `PCAModel` detect it, or do the feature functions return this class? Is that annoying? Should we make PCA calculation a function that returns the correct class/handles this? Similar to `Scale`?\r\n  2. Add a new ``init_from_matrix`` method to `PCAModel`.\r\n      - **Pros**: Simple to implement. Easy interop with a variety of data sources\r\n      - **Cons**: What about the usages of `as_vector`/`from_vector` inside `PCAModel`. Perhaps this is combined with (1) - the `Vector` class?\r\n  3. Make some other class that handles non-`Vectorizable` objects.\r\n      - **Pros**: `PCAModel` stays 'pure'\r\n      - **Cons**: How do we account for this inside of MenpoFit? Detect ala a PCA function (as mentioned in (1))? What about methods like instance? What happens then? Do other methods that rely on `PCAModel` also expect a guarantee that PCA models always return `Vectorizable` instances?"},"comment":{"url":"https://api.github.com/repos/menpo/menpo/issues/comments/136649399","html_url":"https://github.com/menpo/menpo/issues/626#issuecomment-136649399","issue_url":"https://api.github.com/repos/menpo/menpo/issues/626","id":136649399,"user":{"login":"nontas","id":4224739,"avatar_url":"https://avatars.githubusercontent.com/u/4224739?v=3","gravatar_id":"","url":"https://api.github.com/users/nontas","html_url":"https://github.com/nontas","followers_url":"https://api.github.com/users/nontas/followers","following_url":"https://api.github.com/users/nontas/following{/other_user}","gists_url":"https://api.github.com/users/nontas/gists{/gist_id}","starred_url":"https://api.github.com/users/nontas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nontas/subscriptions","organizations_url":"https://api.github.com/users/nontas/orgs","repos_url":"https://api.github.com/users/nontas/repos","events_url":"https://api.github.com/users/nontas/events{/privacy}","received_events_url":"https://api.github.com/users/nontas/received_events","type":"User","site_admin":false},"created_at":"2015-09-01T09:32:47Z","updated_at":"2015-09-01T09:32:47Z","body":"I think we need to combine proposals 1 and 2. Specifically:\r\n* Create a `Vector` class that provides dummy implementations of `as_vector()` and `from_vector()`.\r\n* The class should also provide a dummy implementation of `view()` which could either return an error or (preferably) render a histogram with the vector's values.\r\n* It seems a great idea to me to add `init_from_matrix()` in `PCAModel`. "}}