Skip to main content

Package with the PCA, SVD and t-SNE methods for dimensionality reduction. It also contains the clustering algorithms K-Means and K-Medoids.

Project description

PyPI Version Package Status Python Versions License

What is it?

dimensionality_reductions_jmsv is a Python package that provides three methods (PCA, SVD, t-SNE) to apply dimensionality reduction to any dataset. Aslo provides two methods (KMeans y KMedoids) to clustering.

Installing the package

  1. Requests is available on PyPI:

    pip install dimensionality_reductions_jmsv
    
  2. Try your first dimensionality reduction with PCA

    from dimensionality_reductions_jmsv.decomposition import PCA
    import numpy as np
    
    X = (np.random.rand(10, 10) * 10).astype(int)
    pca = PCA(n_components=2)
    X_pca = pca.fit_transform(X)
    print("Original Matrix:", '\n', X, '\n')
    print("Apply dimensionality reduction with PCA to Original Matrix:", '\n', X_pca)
    
  3. Try your first KMeans cluster

    from dimensionality_reductions_jmsv.cluster import KMeans
    from sklearn.datasets import make_blobs
    import matplotlib.pyplot as plt
    
    X, y = make_blobs(n_samples=500, n_features=2, centers=4, cluster_std=1, center_box=(-10.0, 10.0), shuffle=True,
                      random_state=1, )
    k = KMeans(n_clusters=4, init_method='kmeans++', random_state=32, n_init=10)
    m = k.fit_transform(X)
    
    plt.scatter(X[:, 0], X[:, 1], c=k._assign_clusters(X))
    plt.title('Cluster KMeans')
    plt.show();
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dimensionality_reductions_jmsv-0.2.0.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page