Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

PCA in sklearn

import numpy as np
from sklearn.decomposition import PCA
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
pca = PCA(n_components=2)
pca.fit(X)

print(pca.explained_variance_ratio_)

print(pca.singular_values_)
Comment

PREVIOUS NEXT
Code Example
Python :: tkinter background color 
Python :: import forms 
Python :: python get time milliseconds 
Python :: datetime one week ago python 
Python :: get the number of today week python 
Python :: decisiontreeclassifier sklearn 
Python :: how to count stopwords in df 
Python :: How to check how much time elapsed Python 
Python :: colab tqdm import 
Python :: pyspark create empty dataframe 
Python :: python day number from date 
Python :: python except show error 
Python :: upgrade python to 3.8 
Python :: convert dataframe column to float 
Python :: reduced fraction python 
Python :: django queryset average of unique values 
Python :: add self role with discord bot python 
Python :: remove unicode from string python 
Python :: Function to a button in tkinter 
Python :: python how to get script directory 
Python :: python program to print list vertically without using loop 
Python :: tkinter execute function on enter 
Python :: RandomForestRegressor import 
Python :: django jinja subset string 
Python :: get ip from request django 
Python :: python convert list to dict with index 
Python :: scikit learn ridge classifier 
Python :: python return -1 
Python :: python blackjack 
Python :: rvec tvec ros message 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =