Comments (3)
I'm assuming you have the sparse matrix in the three-column format, with one column for values, one for row numbers, and one for column numbers, right?
In that case, use SparseMatrix.from_lists(values, rows, cols), passing it the columns of your matrix separately.
from divisi2.
I have a pre build sparce matrix with the pivot table cmd in pandas DF. As show here: http://pandas.pydata.org/pandas-docs/stable/generated/pandas.tools.pivot.pivot_table.html
How would I load that into Divisi.
On March 18, 2014 at 10:45:05 AM, Rob Speer ([email protected]) wrote:
I'm assuming you have the sparse matrix in the three-column format, with one column for values, one for row numbers, and one for column numbers, right?
In that case, use SparseMatrix.from_lists(values, rows, cols), passing it the columns of your matrix separately.
—
Reply to this email directly or view it on GitHub.
from divisi2.
The lists of values, rows, and cols would be the things you have in the dataframe before making a pivot table out of it.
Incidentally, divisi2 was largely created as a workaround for features that didn't exist in scipy at the time. I don't think divisi2 is necessary anymore, especially given that you're using Pandas. The following may be a better approach:
- Convert your dataframe to a SciPy sparse matrix (http://stackoverflow.com/questions/20459536/convert-pandas-dataframe-to-sparse-numpy-matrix-directly)
- Use SciPy to calculate the sparse SVD (http://docs.scipy.org/doc/scipy/reference/generated/scipy.sparse.linalg.svds.html).
- Reattach your data labels to the SciPy result using Pandas
from divisi2.
Related Issues (9)
- divisi2.network is unnecessarily slow HOT 1
- DenseMatrix doesn't display labels HOT 1
- Blending is slow and memory-intensive HOT 1
- DenseMatrix SVD needs enough RAM to compute the full SVD
- np.mean(DenseMatrix, axis=n) gives a malformed DenseMatrix
- SVD of a 0x0 matrix leads to infinite recursion
- Python 3? HOT 4
- Class "SparseMatrix" doesn't have method "edges_iter" HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from divisi2.