[PYTHON] Principal component analysis hands-on with PyCaret [normalization + visualization (plotly)] memo

Overview

Source code

Own data formatting code


import pandas as pd
def load_sampledata():
    data = pd.read_csv(r'pycaret_sample.csv',
            encoding='shift-jis',
            engine='python',
            index_col=[0],
            parse_dates=[0])

    data = data.resample('h').sum()
    data['hour'] = data.index.hour
    data['date'] = data.index.strftime('%Y-%m-%d (%a)')
    dataset = data.pivot(index='hour',columns='date',values='Electric energy')
    dataset = dataset.T.reset_index()
    return dataset

setup


from pycaret.clustering import * 
clu = setup(data = load_sampledata(),normalize=True)

create_model&plot


# creating a model
hclust = create_model('hclust')
# plotting a model
plot_model(hclust,plot='cluster',feature='date')

Summary

Recommended Posts

Principal component analysis hands-on with PyCaret [normalization + visualization (plotly)] memo
Principal component analysis with Spark ML
Principal Component Analysis with Livedoor News Corpus-Practice-
Principal component analysis
Principal component analysis with Livedoor News Corpus --Preparation--
[Various image analysis with plotly] Dynamic visualization with plotly [python, image]
Dimensional compression with self-encoder and principal component analysis
I tried principal component analysis with Titanic data!
Principal component analysis (Principal component analysis: PCA)
Collaborative filtering with principal component analysis and K-means clustering
Challenge principal component analysis of text data with Python
Principal component analysis using python from nim with nimpy
Unsupervised learning 3 Principal component analysis
Face recognition using principal component analysis
Data analysis starting with python (data visualization 1)
Python: Unsupervised Learning: Principal Component Analysis
Data analysis starting with python (data visualization 2)
<Course> Machine learning Chapter 4: Principal component analysis
Let's start multivariate analysis and principal component analysis with Pokemon! Collaboration between R and Tableau