{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import shelve\n", "import numpy\n", "import pandas\n", "import sklearn.manifold\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": true }, "outputs": [], "source": [ "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": true }, "outputs": [], "source": [ "data=shelve.open(\"./Sparse_mat.shelve\")" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [], "source": [ "array_test=data[\"ASR\"][\"DEV\"].toarray()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "(175, 1060)" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "array_test.shape" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [], "source": [ "max_list=numpy.max(array_test,axis=1)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [], "source": [ "a=pandas.DataFrame([numpy.divide(x,numpy.float(max(x))) for x in array_test])" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", " | 0 | \n", "1 | \n", "2 | \n", "3 | \n", "4 | \n", "5 | \n", "6 | \n", "7 | \n", "8 | \n", "9 | \n", "... | \n", "1050 | \n", "1051 | \n", "1052 | \n", "1053 | \n", "1054 | \n", "1055 | \n", "1056 | \n", "1057 | \n", "1058 | \n", "1059 | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | \n", "1.000000 | \n", "0.700000 | \n", "0.100000 | \n", "0.1 | \n", "0.000000 | \n", "0 | \n", "0 | \n", "0 | \n", "0.100000 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "
1 | \n", "0.500000 | \n", "0.000000 | \n", "0.250000 | \n", "0.0 | \n", "0.000000 | \n", "0 | \n", "0 | \n", "0 | \n", "0.000000 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "
2 | \n", "0.000000 | \n", "0.500000 | \n", "0.000000 | \n", "1.0 | \n", "0.000000 | \n", "0 | \n", "0 | \n", "0 | \n", "0.000000 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "
3 | \n", "0.333333 | \n", "0.166667 | \n", "0.666667 | \n", "0.0 | \n", "0.333333 | \n", "0 | \n", "0 | \n", "0 | \n", "0.333333 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "
4 | \n", "0.500000 | \n", "0.500000 | \n", "0.000000 | \n", "0.0 | \n", "0.000000 | \n", "0 | \n", "0 | \n", "0 | \n", "0.000000 | \n", "0 | \n", "... | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "0 | \n", "
5 rows × 1060 columns
\n", "