{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## PCA ##\n", "\n", "Explain the initial dataset\n", "\n", "What type of transformation was performed?\n", "\n", "What is the meaning of this transformation?\n", "\n", "What other type of processing may be performed?" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "from sklearn.decomposition import PCA\n", "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "\n", "df=pd.read_csv(\"https://raw.githubusercontent.com/masterfloss/data/main/worlddata.csv\")" ] }, { "cell_type": "code", "execution_count": 28, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Country object\n", "Area_km2 int64\n", "Birth rate(births/1000 population) float64\n", "Current account balance float64\n", "Death rate(deaths/1000 population) float64\n", "Debt - external float64\n", "Electricity - consumption(kWh) float64\n", "Electricity - production(kWh) float64\n", "Exports float64\n", "GDP object\n", "GDPpercapita float64\n", "GDP - real growth rate(%) float64\n", "HIV/AIDS - adult prevalence rate(%) float64\n", "HIV/AIDS - deaths float64\n", "HIV/AIDS - people living with HIV/AIDS float64\n", "Highways(km) float64\n", "Imports float64\n", "Industrial production growth rate(%) float64\n", "Infant mortality rate(deaths/1000 live births) float64\n", "Inflation rate (consumer prices)(%) float64\n", "Internet hosts float64\n", "Internet users float64\n", "Investment (gross fixed)(% of GDP) float64\n", "Labor force float64\n", "Life expectancy at birth(years) float64\n", "Military expenditures - dollar figure float64\n", "MilitPercentGDP float64\n", "Natural gas - consumption(cu m) float64\n", "Natural gas - exports(cu m) float64\n", "Natural gas - imports(cu m) float64\n", "Natural gas - production(cu m) float64\n", "Natural gas - proved reserves(cu m) float64\n", "Oil - consumption(bbl/day) float64\n", "Oil - exports(bbl/day) float64\n", "Oil - imports(bbl/day) float64\n", "Oil - production(bbl/day) float64\n", "Oil - proved reserves(bbl) float64\n", "Population float64\n", "Public debt(% of GDP) float64\n", "Railways(km) float64\n", "Reserves of foreign exchange & gold float64\n", "Telephones - main lines in use float64\n", "Telephones - mobile cellular float64\n", "Total fertility rate(children born/woman) float64\n", "Unemploy rate(%) float64\n", "dtype: object" ] }, "execution_count": 28, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.dtypes" ] }, { "cell_type": "code", "execution_count": 29, "metadata": {}, "outputs": [], "source": [ "df['GDP']=pd.to_numeric(df['GDP'], downcast='float', errors='coerce')" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(263, 45)" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.shape" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [], "source": [ "df1=df\n", "#remove all columns that have more than 210 observations, df1[columns].count()<210\n", "for column1 in df1:\n", " if df1[column1].count()<200:\n", " df1=df1.drop([column1],axis=1)" ] }, { "cell_type": "code", "execution_count": 36, "metadata": {}, "outputs": [], "source": [ "df1=df1.dropna()" ] }, { "cell_type": "code", "execution_count": 37, "metadata": {}, "outputs": [], "source": [ "df1=df1.drop(['Country'], axis=1)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 38, "metadata": {}, "outputs": [], "source": [ "\n", "from sklearn.preprocessing import StandardScaler\n", "standardizer=StandardScaler()\n", "X=standardizer.fit_transform(df1)" ] }, { "cell_type": "code", "execution_count": 39, "metadata": {}, "outputs": [], "source": [ "\n", "PCAModel = PCA(n_components=4)\n", "XPCA = PCAModel.fit_transform(X)" ] }, { "cell_type": "code", "execution_count": 40, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Original number of features: 23\n", "Reduced number of features: 4\n" ] } ], "source": [ "\n", "print('Original number of features:', X.shape[1])\n", "print('Reduced number of features:', XPCA.shape[1])" ] }, { "cell_type": "code", "execution_count": 50, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([0.47834598, 0.1899588 , 0.07468206, 0.05152297])" ] }, "execution_count": 50, "metadata": {}, "output_type": "execute_result" } ], "source": [ "\n", "PCAModel.explained_variance_ratio_" ] }, { "cell_type": "code", "execution_count": 51, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['Area_km2',\n", " 'Birth rate(births/1000 population)',\n", " 'Death rate(deaths/1000 population)',\n", " 'Debt - external',\n", " 'Electricity - consumption(kWh)',\n", " 'Electricity - production(kWh)',\n", " 'Exports',\n", " 'GDP',\n", " 'GDPpercapita',\n", " 'GDP - real growth rate(%)',\n", " 'Highways(km)',\n", " 'Imports',\n", " 'Infant mortality rate(deaths/1000 live births)',\n", " 'Inflation rate (consumer prices)(%)',\n", " 'Internet users',\n", " 'Labor force',\n", " 'Life expectancy at birth(years)',\n", " 'Oil - consumption(bbl/day)',\n", " 'Oil - production(bbl/day)',\n", " 'Population',\n", " 'Telephones - main lines in use',\n", " 'Telephones - mobile cellular',\n", " 'Total fertility rate(children born/woman)']" ] }, "execution_count": 51, "metadata": {}, "output_type": "execute_result" } ], "source": [ "compScores=PCAModel.components_.T\n", "columnList = list (df1.columns.values)\n", "columnList" ] }, { "cell_type": "code", "execution_count": 52, "metadata": {}, "outputs": [], "source": [ "#dfscores=pd.DataFrame(compScores, columns=columnList)\n", "dfscores=pd.DataFrame(compScores)\n", "dfscores['variables']=columnList\n", "dfscores=dfscores.set_index('variables')" ] }, { "cell_type": "code", "execution_count": 53, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
0 1 2 3
variables
Area_km20.1969180.0780180.0500040.318586
Birth rate(births/1000 population)-0.0893150.409577-0.0640210.092177
Death rate(deaths/1000 population)-0.0484610.328146-0.200144-0.244899
Debt - external0.130537-0.045956-0.295037-0.172489
Electricity - consumption(kWh)0.2886510.062448-0.1197250.055438
Electricity - production(kWh)0.2906300.064372-0.0970050.044311
Exports0.274613-0.031945-0.120021-0.073495
GDP0.2941020.072188-0.012551-0.040399
GDPpercapita0.108571-0.304671-0.237989-0.117714
GDP - real growth rate(%)0.0169270.0094050.1687920.633484
Highways(km)0.2703730.068151-0.1092710.039071
Imports0.278818-0.001610-0.235177-0.070954
Infant mortality rate(deaths/1000 live births)-0.0781950.430071-0.0515990.018524
Inflation rate (consumer prices)(%)-0.0277460.174029-0.0569300.000404
Internet users0.2898960.055756-0.071564-0.066624
Labor force0.1995850.1136880.508396-0.150078
Life expectancy at birth(years)0.083859-0.4319210.0941470.106816
Oil - consumption(bbl/day)0.2760430.047094-0.2167950.076420
Oil - production(bbl/day)0.1843650.026926-0.1008880.512215
Population0.1949280.1184760.500456-0.129348
Telephones - main lines in use0.2769210.0787000.203591-0.102200
Telephones - mobile cellular0.2676110.0570410.199527-0.159440
Total fertility rate(children born/woman)-0.0834870.400337-0.0914520.083502
" ], "text/plain": [ "" ] }, "execution_count": 53, "metadata": {}, "output_type": "execute_result" } ], "source": [ "def selectColor(val):\n", " if (val > 0.25 or val<-0.25):\n", " color = 'red' \n", " else:\n", " color = 'black'\n", " return 'color: %s' % color\n", "\n", "df_pintado = dfscores.style.applymap(selectColor)\n", "df_pintado" ] }, { "cell_type": "code", "execution_count": 61, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[[-1.88576998e+00 5.20264054e+00 -6.87254154e-01 1.62418637e-01]\n", " [-7.34929255e-01 -1.41402718e+00 5.40786078e-01 2.45319708e-01]\n", " [ 1.05844480e-02 -1.00301604e+00 5.04663624e-01 1.04577475e+00]\n", " [-1.83325846e+00 6.37517684e+00 -1.18690695e+00 8.76912644e-01]\n", " [-7.88442514e-01 -1.33927879e+00 2.23418275e-01 -1.95169163e-01]\n", " [ 6.12135475e-01 -1.06794953e+00 3.07886706e-01 9.19881971e-01]\n", " [-7.43593504e-01 -1.29490609e+00 5.63807601e-01 4.43795555e-01]\n", " [-4.83432832e-01 -2.51297169e+00 -2.55500363e-01 -1.05994673e+00]\n", " [ 2.48227142e+00 -1.96143885e+00 -6.27728438e-01 6.15050683e-01]\n", " [ 6.15450992e-01 -2.55153607e+00 -5.89536541e-01 -1.01756285e+00]\n", " [-9.33467808e-01 4.98820381e-01 2.68640696e-01 6.90733684e-01]\n", " [-7.93198008e-01 -1.00401233e+00 -1.33289980e-01 -4.87513161e-01]\n", " [-6.14452800e-01 -1.61645017e+00 1.30936664e-01 1.66676208e-01]\n", " [-5.41999888e-01 1.06887613e+00 1.02328974e+00 -1.59577740e-01]\n", " [-6.75704864e-01 -1.67296281e+00 2.43150150e-03 -6.03882120e-01]\n", " [-5.10151442e-01 -7.54728350e-01 8.39576586e-02 -2.22230423e-01]\n", " [ 1.39524765e+00 -2.38073308e+00 -1.04445618e+00 -1.12248964e+00]\n", " [-1.06159687e+00 -7.41458940e-02 1.14834446e-01 4.15780203e-02]\n", " [-4.06967567e-01 -2.56203006e+00 -3.92846599e-01 -7.45901647e-01]\n", " [-8.98780684e-01 2.48397319e-01 2.33643048e-01 1.06921980e-01]\n", " [-7.03023718e-01 -1.31602995e+00 3.61710647e-01 -8.80760711e-02]\n", " [-1.37252211e+00 2.48904076e+00 -1.06072106e+00 -1.36820895e+00]\n", " [ 4.61735906e+00 3.27609787e-01 1.06326022e+00 1.28238304e+00]\n", " [-4.18232611e-01 -2.60308349e+00 -3.84871899e-01 -7.42889632e-01]\n", " [-5.44882694e-01 -1.95245252e+00 -1.80908935e-03 -1.10323436e-01]\n", " [-5.28147928e-01 -1.06046069e+00 1.08704376e-01 -4.11110659e-01]\n", " [-1.73984778e+00 3.83449848e+00 -6.33900784e-01 -2.14129133e-01]\n", " [-9.44106991e-01 8.29070826e-01 1.17837892e-01 -1.07432605e+00]\n", " [-1.68486253e+00 3.22724041e+00 -6.17687972e-01 -4.81454825e-01]\n", " [-1.17937315e+00 9.96437519e-01 1.65500233e-01 1.16709571e-01]\n", " [-1.34919571e+00 2.29003746e+00 -2.67241830e-01 -1.49962561e-01]\n", " [ 5.59528307e+00 -1.69118820e+00 -1.96363037e+00 1.51689391e+00]\n", " [-4.31082627e-01 -2.66350404e+00 -1.87184539e-01 -5.76705504e-01]\n", " [-7.09329217e-02 -1.57685434e+00 3.79385368e-01 1.67613162e-01]\n", " [ 2.18431048e+01 4.61643703e+00 1.05517487e+01 -2.91539251e+00]\n", " [-4.71850018e-02 -6.53082772e-01 5.14955060e-01 1.73950488e-01]\n", " [-1.44932951e+00 1.71816195e+00 -1.35720746e-01 -7.88346091e-02]\n", " [-1.29796945e+00 3.75277576e+00 -1.33088930e-01 6.87568227e-01]\n", " [-6.50713438e-01 -1.40545903e+00 3.15869813e-01 2.58373307e-02]\n", " [-1.42586957e+00 2.56966513e+00 -4.93362348e-01 -9.25997151e-01]\n", " [-4.75486118e-01 -1.66292842e+00 1.15017005e-01 -5.14030583e-01]\n", " [-5.91651857e-01 -1.60225802e+00 4.71734990e-01 -1.89545575e-01]\n", " [-7.02072033e-01 -1.68759667e+00 3.10896574e-01 -3.24517294e-01]\n", " [ 2.27883647e-01 -1.97307710e+00 -8.11469508e-02 -6.72832402e-01]\n", " [ 2.68425512e-01 -2.32932838e+00 -5.88261339e-01 -8.34888395e-01]\n", " [-1.75876309e+00 3.56055375e+00 -7.31431482e-01 -5.09452528e-01]\n", " [-8.20589541e-01 -1.38241104e+00 2.14627411e-01 -7.30104884e-01]\n", " [-4.81529936e-01 -8.53136923e-01 4.66674596e-01 6.43576531e-01]\n", " [ 1.22931929e-02 -1.51807799e-01 5.94673473e-01 4.28593840e-01]\n", " [-9.23895219e-01 -3.41726196e-01 1.91616395e-01 -1.99195447e-01]\n", " [-5.79745029e-01 -1.52585489e+00 2.76788494e-02 -3.23511166e-01]\n", " [-5.78385882e-01 -1.93841737e+00 1.60946783e-01 4.76100206e-01]\n", " [-9.08523921e-01 -8.17470691e-01 2.85294623e-01 -1.67535405e-02]\n", " [ 2.22206900e-01 -2.33625627e+00 -4.04448784e-01 -7.05468374e-01]\n", " [-1.29414749e+00 1.58602891e+00 -3.87252831e-01 -2.63750730e-01]\n", " [-1.53107658e+00 2.32791942e+00 -2.41866513e-01 2.51494378e-01]\n", " [-6.97354698e-01 -1.39435996e+00 6.23100757e-01 5.13987462e-01]\n", " [-1.06528441e+00 9.13704683e-01 1.23515175e-01 -6.27949581e-02]\n", " [ 1.35782427e-01 -2.15212395e+00 -1.08185960e-01 -6.18681445e-01]\n", " [-9.66509273e-01 -5.96173226e-01 1.85581939e-01 -2.89606744e-01]\n", " [-1.09110063e+00 7.51062375e-01 3.80876338e-02 -3.27137719e-02]\n", " [-1.65918991e+00 3.33475988e+00 -6.80330648e-01 -5.49742376e-01]\n", " [-1.68158845e+00 3.12151694e+00 -5.76347432e-01 -4.96866404e-01]\n", " [-9.46369102e-01 -4.86413891e-01 1.67777672e-01 -4.09097799e-01]\n", " [-1.55114727e+00 2.47739751e+00 -5.99641591e-01 -1.10206125e+00]\n", " [-1.09252979e+00 3.71598982e-01 1.68410771e-01 1.40289328e-01]\n", " [ 1.57616495e+00 -3.31933966e+00 -1.00289269e+00 -5.35548989e-01]\n", " [-1.45367888e-02 -1.46935321e+00 -1.90441911e-01 -7.25777510e-01]\n", " [-3.92973059e-01 -2.53799521e+00 -2.61855340e-01 -6.27858039e-01]\n", " [ 7.22145494e+00 3.07693240e+00 6.77383766e+00 -1.32198087e+00]\n", " [ 1.47847525e+00 1.77580174e-01 1.55772553e+00 1.41610112e-01]\n", " [ 1.12548567e+00 -3.49852219e-01 1.76777464e-01 1.88218813e+00]\n", " [-4.01411881e-01 1.06669913e+00 1.51198312e+00 7.49625477e+00]\n", " [ 1.99150240e-01 -2.33949465e+00 -4.26581894e-01 -4.06816438e-01]\n", " [-1.15176963e-01 -1.86909032e+00 -6.37078222e-02 -2.75451143e-01]\n", " [ 4.38655999e+00 -2.03560023e+00 -1.50888374e+00 -2.16383863e+00]\n", " [-7.45020565e-01 -1.28361105e+00 3.59199561e-01 -2.59757426e-01]\n", " [-7.31595852e-01 -1.21247384e+00 5.48597228e-01 3.96849036e-01]\n", " [-6.74367816e-02 -5.21079325e-01 2.65729492e-01 1.23142994e+00]\n", " [-1.35717371e+00 2.66178215e+00 -3.05583369e-01 -4.41145867e-01]\n", " [-1.29024037e+00 9.04791001e-01 -2.42082123e-02 -2.64048240e-01]\n", " [ 3.17618949e+00 -1.81339688e+00 -4.70493172e-01 -9.33104238e-01]\n", " [-7.29553810e-02 -1.66959721e+00 -6.77369448e-02 1.32659832e+00]\n", " [-9.53702322e-01 -2.41358680e-01 3.91968061e-01 2.97452514e-01]\n", " [-1.45505665e+00 2.28893573e+00 -2.02926305e-01 2.16872421e-01]\n", " [-5.96698107e-01 -1.37471571e+00 1.34327348e-01 -1.24918104e-01]\n", " [-7.61268431e-01 -1.05505688e+00 3.65368927e-01 -4.72250776e-02]\n", " [-1.57062353e+00 2.85974333e+00 -8.25509218e-01 -1.11450865e+00]\n", " [-3.37774685e-01 -6.23872558e-01 2.31216836e-01 1.23707786e+00]\n", " [-4.48171260e-01 -1.81615516e+00 2.27033769e-01 -1.31838486e-01]\n", " [-3.71449191e-01 -2.84641657e+00 7.35228243e-01 1.35143864e+00]\n", " [-7.05110658e-01 -1.56145784e+00 2.35192347e-01 -6.02148333e-01]\n", " [-1.43289234e+00 2.52715472e+00 -1.31850112e-01 3.25229383e-01]\n", " [-1.87315609e+00 4.51630531e+00 -9.33099559e-01 -6.17177465e-01]\n", " [ 5.43732869e-01 -7.53776818e-01 3.53936290e-02 5.29425877e-01]\n", " [-1.73342116e+00 4.27844313e+00 -7.15219124e-01 -1.14847344e-01]\n", " [-5.39347058e-01 -2.25510896e+00 2.94343633e-02 -7.15935576e-01]\n", " [-1.49136454e+00 2.68144182e+00 -4.03614505e-01 2.69259067e-03]\n", " [-7.11074816e-01 -1.44413210e+00 2.08531163e-01 -9.27528871e-02]\n", " [ 2.80434344e+00 -5.72609528e-01 -9.50743490e-02 1.09327085e+00]\n", " [-9.70625880e-01 -1.12034242e-01 2.14419296e-01 -2.42681912e-02]\n", " [-8.61664678e-01 1.21784241e-01 5.08421905e-01 1.06862775e+00]\n", " [-5.80960854e-01 -3.62869238e-01 4.99322601e-01 7.77263563e-02]\n", " [-1.62377320e+00 3.99114388e+00 -5.26723880e-01 3.80126660e-02]\n", " [-1.20097242e+00 1.56274893e+00 -4.74727845e-01 -5.04401610e-01]\n", " [-1.23084181e+00 1.32434431e+00 9.35868444e-02 -1.57712577e-01]\n", " [-7.04726632e-01 -1.67179735e+00 1.40187179e-01 -5.78088529e-01]\n", " [-1.50115786e-01 -2.13399365e+00 -6.82365334e-02 -2.06968497e-01]\n", " [-9.60836173e-01 -3.80003698e-01 3.77395762e-01 1.77101644e-01]\n", " [-1.82850048e+00 4.67617839e+00 -8.93326464e-01 -2.68469476e-01]\n", " [-5.81138637e-01 3.85420120e+00 -2.78328911e-02 7.70232297e-01]\n", " [ 9.14067752e-01 -2.58039170e+00 -9.21764969e-01 5.51332268e-01]\n", " [-8.53916473e-01 1.43448930e-01 -2.27334103e-01 3.04137142e-01]\n", " [-2.80145774e-01 1.47625519e+00 8.52432259e-01 2.04303845e-01]\n", " [-7.84819632e-01 -9.41556139e-01 3.44013173e-01 2.23194381e-01]\n", " [-1.13783842e+00 6.82720010e-01 2.95534997e-02 -2.28203964e-01]\n", " [-8.81466084e-01 -2.34903494e-01 2.51975318e-01 1.58963414e-01]\n", " [-4.27412819e-01 -4.81157945e-01 4.06160314e-01 1.96593444e-01]\n", " [ 9.12217974e-02 -1.52471102e-01 7.64705365e-01 8.48625891e-02]\n", " [ 9.58114931e-01 -1.43982616e+00 1.67996339e-01 -4.58383595e-01]\n", " [ 1.44479840e-01 -1.96725578e+00 -3.07973559e-01 -1.06822013e+00]\n", " [-4.35023237e-01 -1.66874666e+00 3.83453757e-02 7.76173112e-01]\n", " [-9.16666883e-02 -9.24628582e-01 2.82389128e-01 7.81245455e-02]\n", " [ 6.44753587e+00 7.63355950e-01 -2.47908233e-01 5.23439809e+00]\n", " [-1.67594326e+00 3.21006028e+00 -6.30581283e-01 -6.89650028e-01]\n", " [-8.62713962e-01 -1.09179230e+00 -1.77803813e-02 -9.46570575e-01]\n", " [-8.48210064e-01 -1.19045958e+00 3.75572580e-01 -4.19135066e-02]\n", " [-8.38683643e-01 -1.33454755e+00 3.68206109e-01 -4.47151224e-01]\n", " [-9.18317320e-01 -7.59572308e-01 3.05677192e-01 1.05815174e-01]\n", " [ 1.81473358e+00 -3.92553790e-01 -7.46451857e-01 4.14361485e+00]\n", " [-1.31571511e+00 1.59025415e+00 -9.98697114e-02 -1.24435352e-01]\n", " [-5.84479098e-01 -1.09534085e+00 4.54063646e-01 4.82397271e-02]\n", " [-8.05049168e-01 -1.33470598e+00 2.31152316e-01 -4.36450422e-01]\n", " [-1.87827660e+00 4.34675811e+00 -7.37005323e-01 -1.71487518e-01]\n", " [ 7.99563160e-01 -3.04271937e+00 -2.89632330e-01 5.52306546e-02]\n", " [-2.94662294e-01 -1.77233865e+00 9.48168760e-02 -2.77582154e-01]\n", " [-3.83879067e-01 -2.14307197e+00 -2.59806361e-02 -5.32925600e-01]\n", " [-1.09423202e+00 -3.43741401e-02 3.71727599e-01 5.74019481e-01]\n", " [ 1.96809931e-01 1.59590966e+00 -6.06750541e-01 -1.02281511e+00]\n", " [ 2.85862751e+00 -1.99754358e+00 -1.05352905e+00 -1.43165296e+00]\n", " [-6.64993570e-01 -1.20365366e+00 5.48975262e-01 5.78540839e-02]\n", " [-9.39458146e-01 1.80853842e+00 1.85334847e-01 8.28099157e-01]\n", " [-9.43565334e-01 -4.54258072e-01 2.07861770e-01 -1.76424442e-02]\n", " [-1.55957454e+00 2.80501872e+00 -9.28764074e-01 -1.24166410e+00]\n", " [ 9.03831016e-01 -2.32062812e+00 -5.74372110e-01 -7.31432496e-01]\n", " [-7.52547614e-01 -1.24372688e-01 2.36848315e-01 1.82006185e-01]\n", " [ 1.70659154e+00 -2.13277885e+00 -3.13064410e-01 -5.25771753e-01]\n", " [-1.30627710e+00 1.70578605e+00 2.20476741e-01 9.96613007e-01]\n", " [-1.41028187e+00 3.28055666e+00 -2.24073268e-01 -2.79974863e-02]\n", " [ 8.97941443e-01 -9.24326705e-01 6.03414339e-01 -1.34858414e-01]\n", " [-1.41292088e+00 1.83141266e+00 -2.19554284e-01 -2.64565779e-01]\n", " [-1.02081387e+00 -4.44696940e-01 2.33398006e-01 -2.03733809e-01]\n", " [-7.16844552e-01 -1.15369019e+00 1.68892544e-01 -6.01359883e-02]\n", " [-5.69874949e-01 -1.38112048e+00 4.58060832e-01 1.34835408e-01]\n", " [ 1.03665566e+00 -5.12227118e-01 7.20520144e-01 2.10313537e-01]\n", " [-1.07078159e+00 9.19078378e-01 5.63768210e-02 5.22113359e-01]\n", " [-1.55662067e+00 3.11219292e+00 -2.55820554e-01 1.58446292e-01]\n", " [ 2.05874787e-01 -3.48867160e-01 3.80717308e-01 3.46869244e-01]\n", " [ 2.06768168e-01 -1.66184785e+00 -3.64724780e-01 9.64816951e-01]\n", " [ 6.46121533e+00 -2.24351449e+00 -4.72296485e+00 -2.95501317e+00]\n", " [ 3.11932755e+01 3.12141809e+00 -7.80141695e+00 1.09179881e+00]\n", " [-5.88595316e-01 -1.51938458e+00 3.15005524e-01 5.40463287e-01]\n", " [-8.42478947e-01 6.55676604e-01 2.96120756e-01 1.29444423e-01]\n", " [ 2.68453626e-01 -6.28818599e-01 5.78791229e-01 2.80590240e+00]\n", " [-1.06550268e-01 -6.28268526e-01 9.98875891e-01 4.08624204e-01]\n", " [-1.33069836e+00 2.38814868e+00 -2.35028819e-01 2.34063061e-01]\n", " [-1.64452516e+00 3.93383145e+00 -7.49372117e-01 -3.24335934e-01]\n", " [-1.82174012e+00 4.82223769e+00 -1.77434236e+00 -2.53293667e+00]]\n" ] } ], "source": [ "print(XPCA)" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.7.6" } }, "nbformat": 4, "nbformat_minor": 2 }