INVBAT.COM - AI + CHATBOT solving the problem of forgetting to make knowledge acquisition, retention, and application better from today's knowledge transfer pedagogy

Sponsor by Ads space available $375 per year, click here




Learn Once and Never Forget - Now Possible !
Ebbinghaus forgetting curve no longer true if you have a personal chatbot

To 1.6 billion students, learn once and never forget your formula, calculator, question and answer reviewer if you have a personal chatbot + AI. For $2 per month for cloud hosting and data entry service we can create your personal chatbot + AI.



Is subscription to personal chatbot + AI that guarantees your formulas, calculators, and reviewer available to you on demand using your smartphone and tablet worth it? Yes, if you are paying more than $24 per year for your web hosting.

Subscription price subject to change without prior notice.


IMAGINE YOU HAVE A PERSONAL AUGMENTED INTELLIGENT CHATBOT ⤵ 👈

School administrator, principal, and math teacher imagine you provided all your students a personal math augmented intelligent chatbot powered by A.I. and cloud technology that can help them to master 300 mathematics concepts your "State" expected them to master. Imagine this math augmented intelligence chatbot technology is on demand using tablet, Chromebook, laptop, or using their personal smartphone. Will you subscribe if it will cost your school $15 per year?

The two learning pain points in Science, Technology, Engineering, Arts, and Mathematics (STEAM) are first knowledge retention of formulas, theories, and equations. The second pain point is not having scientific calculator on demand. INVBAT.COM - A.I. + CHATBOT solved these two pain points of full time students, teachers, and working students by using artificial intelligence (A.I.) and cloud technology.





Sample ads image placeholder. Advertising rate $375 per year

Additional bonus if your school , community college, and university advertise, all your students and teachers will get free personal memory assistant chatbot for one month. ⤵ 👈


Ads refund guaranteed by our founder no question ask if your ads is not deployed within 24 hours from the time of receipt of your advertising website link or You Tube or Vimeo link.

Advertise on this webpage. Use PayPal
After payment e-mail admin@invbat.com your advertising website link or your You Tube link and we will insert them on this webpage.



How to use Python seaborn , sklearn, matplotlib, numpy, and pandas libraries


INVBAT.COM -A.I.
The Personal Memory Assistant Company

BECAUSE MOST OF US FORGET




seaborn , sklearn, matplotlib, numpy, and pandas

In [1]:
# comment : import the Python library
import pandas as pd
import numpy as np
import time as time
import warnings
import mpl_toolkits.mplot3d.axes3d as p3
import seaborn as sns
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from sklearn.cluster import KMeans
from sklearn.decomposition import PCA
from sklearn.cluster import AgglomerativeClustering
from sklearn.datasets import make_swiss_roll
from sklearn import cluster, datasets
from sklearn.preprocessing import StandardScaler
from itertools import cycle, islice

from sklearn import datasets

# comments : Do Shift + enter
In [2]:
print('mpg.xlsx file is located at directory  /Users/invbat/projects/mpg.xlsx') 
print('Remember the directory path of your filename for example mpg.xlsx. Otherwise you will get error message')
print('It is very important to manually type the path to the file directory because of persistent memory for ')
print('previous file path otherwise you will get error message')
print('')
mpg = pd.read_excel('/Users/embee/projects/mpg.xlsx')
mpg.head()
# comment # do shift + enter
mpg.xlsx file is located at directory  /Users/invbat/projects/mpg.xlsx
Remember the directory path of your filename for example mpg.xlsx. Otherwise you will get error message
It is very important to manually type the path to the file directory because of persistent memory for 
previous file path otherwise you will get error message

Out[2]:
mpg cylinders displacement horsepower weight acceleration model_year origin name
0 18.0 8 307.0 130.0 3504 12.0 70 usa chevrolet chevelle malibu
1 15.0 8 350.0 165.0 3693 11.5 70 usa buick skylark 320
2 18.0 8 318.0 150.0 3436 11.0 70 usa plymouth satellite
3 16.0 8 304.0 150.0 3433 12.0 70 usa amc rebel sst
4 17.0 8 302.0 140.0 3449 10.5 70 usa ford torino
In [3]:
# comment : Show me the graph of car mpg versus horsepower
sns.set(style="white")

# Load the example mpg dataset
mpg = sns.load_dataset("mpg")

# Plot miles per gallon against horsepower with other semantics
sns.relplot(x="horsepower", y="mpg", hue="origin", size="weight",
            sizes=(40, 400), alpha=.5, palette="muted",
            height=6, data=mpg)
# comment # Do shift + enter
Out[3]:
<seaborn.axisgrid.FacetGrid at 0x1defe855e08>
In [4]:
print('iris.xlsx file is located at directory  /Users/invbat/projects/iris.xlsx') 
print('Remember the directory path of your filename for example iris.xlsx. Otherwise you will get error message')
print('It is very important to manually type the path to the file directory because of persistent memory for ')
print('previous file path otherwise you will get error message')
print('')
iris = pd.read_excel('/Users/embee/projects/iris.xlsx')
iris.head()
# comment # do shift + enter
iris.xlsx file is located at directory  /Users/invbat/projects/iris.xlsx
Remember the directory path of your filename for example iris.xlsx. Otherwise you will get error message
It is very important to manually type the path to the file directory because of persistent memory for 
previous file path otherwise you will get error message

Out[4]:
sepal_length sepal_width petal_length petal_width species
0 5.1 3.5 1.4 0.2 setosa
1 4.9 3.0 1.4 0.2 setosa
2 4.7 3.2 1.3 0.2 setosa
3 4.6 3.1 1.5 0.2 setosa
4 5.0 3.6 1.4 0.2 setosa
In [5]:
# comments : I want to see scatter plot with categorical variables
sns.set(style="whitegrid", palette="muted")

# Load the example iris dataset
iris = sns.load_dataset("iris")

# "Melt" the dataset to "long-form" or "tidy" representation
iris = pd.melt(iris, "species", var_name="measurement")

# Draw a categorical scatterplot to show each observation
sns.swarmplot(x="measurement", y="value", hue="species",
              palette=["r", "c", "y"], data=iris)

# comment # Do shift + enter
Out[5]:
<matplotlib.axes._subplots.AxesSubplot at 0x1de84992188>
In [6]:
# comment : Show me a multiple bivariate Kernel Density Estimate (kde) plot
sns.set(style="darkgrid")
iris = sns.load_dataset("iris")

# Subset the iris dataset by species
setosa = iris.query("species == 'setosa'")
virginica = iris.query("species == 'virginica'")

# Set up the figure
f, ax = plt.subplots(figsize=(10, 8))
ax.set_aspect("equal")

# Draw the two density plots
ax = sns.kdeplot(setosa.sepal_width, setosa.sepal_length,
                 cmap="Reds", shade=True, shade_lowest=False)
ax = sns.kdeplot(virginica.sepal_width, virginica.sepal_length,
                 cmap="Blues", shade=True, shade_lowest=False)

# Add labels to the plot
red = sns.color_palette("Reds")[-2]
blue = sns.color_palette("Blues")[-2]
ax.text(2.5, 8.2, "virginica", size=16, color=blue)
ax.text(3.8, 4.5, "setosa", size=16, color=red)

# comment # Do shift + enter
Out[6]:
Text(3.8, 4.5, 'setosa')
In [7]:
# comment : Show me the pairwise of iris data set to discover the pair with most linear relationship
# comment : By default, it also draws the univariate distribution of each variable on the diagonal Axes:
sns.pairplot(iris);
# comment # Do shift + enter
In [8]:
# comment : Show me the pair plot of iris data set
# comment : By default, it also draws the univariate distribution of each variable on the diagonal Axes:
sns.pairplot(iris, hue="species");

# comment # Do shift + enter
In [9]:
# comment : use the kernel density estimation to visualize a bivariate distribution
# comment : By default, it also draws the univariate distribution of each variable on the diagonal Axes:
g = sns.PairGrid(iris, hue ="species")
g.map_diag(sns.kdeplot)
g.map_offdiag(sns.kdeplot, n_levels=6);
# comment # Do shift + enter
In [10]:
# comment :
np.random.seed(5)

iris = datasets.load_iris()
X = iris.data
y = iris.target

estimators = [('k_means_iris_8', KMeans(n_clusters=8)),
              ('k_means_iris_3', KMeans(n_clusters=3)),
              ('k_means_iris_bad_init', KMeans(n_clusters=3, n_init=1,
                                               init='random'))]

fignum = 1
titles = ['8 clusters', '3 clusters', '3 clusters, bad initialization']
for name, est in estimators:
    fig = plt.figure(fignum, figsize=(8, 5))
    ax = Axes3D(fig, rect=[0, 0, .95, 1], elev=48, azim=134)
    est.fit(X)
    labels = est.labels_

    ax.scatter(X[:, 3], X[:, 0], X[:, 2],
               c=labels.astype(np.float), edgecolor='k')

    ax.w_xaxis.set_ticklabels([])
    ax.w_yaxis.set_ticklabels([])
    ax.w_zaxis.set_ticklabels([])
    ax.set_xlabel('Petal width')
    ax.set_ylabel('Sepal length')
    ax.set_zlabel('Petal length')
    ax.set_title(titles[fignum - 1])
    ax.dist = 12
    fignum = fignum + 1

# Plot the ground truth
fig = plt.figure(fignum, figsize=(8, 5))
ax = Axes3D(fig, rect=[0, 0, .95, 1], elev=48, azim=134)

for name, label in [('Setosa', 0),
                    ('Versicolour', 1),
                    ('Virginica', 2)]:
    ax.text3D(X[y == label, 3].mean(),
              X[y == label, 0].mean(),
              X[y == label, 2].mean() + 2, name,
              horizontalalignment='center',
              bbox=dict(alpha=.2, edgecolor='w', facecolor='w'))
# Reorder the labels to have colors matching the cluster results
y = np.choose(y, [1, 2, 0]).astype(np.float)
ax.scatter(X[:, 3], X[:, 0], X[:, 2], c=y, edgecolor='k')

ax.w_xaxis.set_ticklabels([])
ax.w_yaxis.set_ticklabels([])
ax.w_zaxis.set_ticklabels([])
ax.set_xlabel('Petal width')
ax.set_ylabel('Sepal length')
ax.set_zlabel('Petal length')
ax.set_title('Ground Truth')
ax.dist = 12

plt.show()

# comment # Do shift + enter
In [11]:
# comment : How to plot three principal components or features for iris flower dataset
iris = datasets.load_iris()
X = iris.data[:, :2]  # we only take the first two features.
y = iris.target

x_min, x_max = X[:, 0].min() - .5, X[:, 0].max() + .5
y_min, y_max = X[:, 1].min() - .5, X[:, 1].max() + .5

plt.figure(2, figsize=(8, 6))
plt.clf()

# Plot the training points
plt.scatter(X[:, 0], X[:, 1], c=y, cmap=plt.cm.Set1,
            edgecolor='k')
plt.xlabel('Sepal length')
plt.ylabel('Sepal width')

plt.xlim(x_min, x_max)
plt.ylim(y_min, y_max)
plt.xticks(())
plt.yticks(())

# To getter a better understanding of interaction of the dimensions
# plot the first three PCA dimensions
fig = plt.figure(1, figsize=(8, 6))
ax = Axes3D(fig, elev=-150, azim=110)
X_reduced = PCA(n_components=3).fit_transform(iris.data)
ax.scatter(X_reduced[:, 0], X_reduced[:, 1], X_reduced[:, 2], c=y,
           cmap=plt.cm.Set1, edgecolor='k', s=40)
ax.set_title("First three PCA directions")
ax.set_xlabel("1st eigenvector")
ax.w_xaxis.set_ticklabels([])
ax.set_ylabel("2nd eigenvector")
ax.w_yaxis.set_ticklabels([])
ax.set_zlabel("3rd eigenvector")
ax.w_zaxis.set_ticklabels([])

plt.show()

# comment # Do shift + enter
In [12]:
# comment : I want to understand the swiss roll clustering for unsupervised machine learning
# Generate data (swiss roll dataset)
n_samples = 1500
noise = 0.05
X, _ = make_swiss_roll(n_samples, noise=noise)
# Make it thinner
X[:, 1] *= .5

# #############################################################################
# Compute clustering
print("Compute unstructured hierarchical clustering...")
st = time.time()
ward = AgglomerativeClustering(n_clusters=6, linkage='ward').fit(X)
elapsed_time = time.time() - st
label = ward.labels_
print("Elapsed time: %.2fs" % elapsed_time)
print("Number of points: %i" % label.size)

# #############################################################################
# Plot result
fig = plt.figure()
ax = p3.Axes3D(fig)
ax.view_init(7, -80)
for l in np.unique(label):
    ax.scatter(X[label == l, 0], X[label == l, 1], X[label == l, 2],
               color=plt.cm.jet(np.float(l) / np.max(label + 1)),
               s=20, edgecolor='k')
plt.title('Without connectivity constraints (time %.2fs)' % elapsed_time)


# #############################################################################
# Define the structure A of the data. Here a 10 nearest neighbors
from sklearn.neighbors import kneighbors_graph
connectivity = kneighbors_graph(X, n_neighbors=10, include_self=False)

# #############################################################################
# Compute clustering
print("Compute structured hierarchical clustering...")
st = time.time()
ward = AgglomerativeClustering(n_clusters=6, connectivity=connectivity,
                               linkage='ward').fit(X)
elapsed_time = time.time() - st
label = ward.labels_
print("Elapsed time: %.2fs" % elapsed_time)
print("Number of points: %i" % label.size)

# #############################################################################
# Plot result
fig = plt.figure()
ax = p3.Axes3D(fig)
ax.view_init(7, -80)
for l in np.unique(label):
    ax.scatter(X[label == l, 0], X[label == l, 1], X[label == l, 2],
               color=plt.cm.jet(float(l) / np.max(label + 1)),
               s=20, edgecolor='k')
plt.title('With connectivity constraints (time %.2fs)' % elapsed_time)

plt.show()

# comment # Do shift + enter
Compute unstructured hierarchical clustering...
Elapsed time: 0.07s
Number of points: 1500
Compute structured hierarchical clustering...
Elapsed time: 0.09s
Number of points: 1500
In [13]:
# comments : Comparing hierarchal clustering algorithm for unsupervised machine learning
np.random.seed(0)
n_samples = 1500
noisy_circles = datasets.make_circles(n_samples=n_samples, factor=.5,
                                      noise=.05)
noisy_moons = datasets.make_moons(n_samples=n_samples, noise=.05)
blobs = datasets.make_blobs(n_samples=n_samples, random_state=8)
no_structure = np.random.rand(n_samples, 2), None

# Anisotropicly distributed data
random_state = 170
X, y = datasets.make_blobs(n_samples=n_samples, random_state=random_state)
transformation = [[0.6, -0.6], [-0.4, 0.8]]
X_aniso = np.dot(X, transformation)
aniso = (X_aniso, y)

# blobs with varied variances
varied = datasets.make_blobs(n_samples=n_samples,
                             cluster_std=[1.0, 2.5, 0.5],
                             random_state=random_state)
# Set up cluster parameters
plt.figure(figsize=(9 * 1.3 + 2, 14.5))
plt.subplots_adjust(left=.02, right=.98, bottom=.001, top=.96, wspace=.05,
                    hspace=.01)

plot_num = 1

default_base = {'n_neighbors': 10,
                'n_clusters': 3}

datasets = [
    (noisy_circles, {'n_clusters': 2}),
    (noisy_moons, {'n_clusters': 2}),
    (varied, {'n_neighbors': 2}),
    (aniso, {'n_neighbors': 2}),
    (blobs, {}),
    (no_structure, {})]

for i_dataset, (dataset, algo_params) in enumerate(datasets):
    # update parameters with dataset-specific values
    params = default_base.copy()
    params.update(algo_params)

    X, y = dataset

    # normalize dataset for easier parameter selection
    X = StandardScaler().fit_transform(X)

    # ============
    # Create cluster objects
    # ============
    ward = cluster.AgglomerativeClustering(
        n_clusters=params['n_clusters'], linkage='ward')
    complete = cluster.AgglomerativeClustering(
        n_clusters=params['n_clusters'], linkage='complete')
    average = cluster.AgglomerativeClustering(
        n_clusters=params['n_clusters'], linkage='average')
    single = cluster.AgglomerativeClustering(
        n_clusters=params['n_clusters'], linkage='single')

    clustering_algorithms = (
        ('Single Linkage', single),
        ('Average Linkage', average),
        ('Complete Linkage', complete),
        ('Ward Linkage', ward),
    )

    for name, algorithm in clustering_algorithms:
        t0 = time.time()

        # catch warnings related to kneighbors_graph
        with warnings.catch_warnings():
            warnings.filterwarnings(
                "ignore",
                message="the number of connected components of the " +
                "connectivity matrix is [0-9]{1,2}" +
                " > 1. Completing it to avoid stopping the tree early.",
                category=UserWarning)
            algorithm.fit(X)

        t1 = time.time()
        if hasattr(algorithm, 'labels_'):
            y_pred = algorithm.labels_.astype(np.int)
        else:
            y_pred = algorithm.predict(X)

        plt.subplot(len(datasets), len(clustering_algorithms), plot_num)
        if i_dataset == 0:
            plt.title(name, size=18)

        colors = np.array(list(islice(cycle(['#377eb8', '#ff7f00', '#4daf4a',
                                             '#f781bf', '#a65628', '#984ea3',
                                             '#999999', '#e41a1c', '#dede00']),
                                      int(max(y_pred) + 1))))
        plt.scatter(X[:, 0], X[:, 1], s=10, color=colors[y_pred])

        plt.xlim(-2.5, 2.5)
        plt.ylim(-2.5, 2.5)
        plt.xticks(())
        plt.yticks(())
        plt.text(.99, .01, ('%.2fs' % (t1 - t0)).lstrip('0'),
                 transform=plt.gca().transAxes, size=15,
                 horizontalalignment='right')
        plot_num += 1

plt.show()
# comment # Do shift enter
In [ ]:
 



IN-V-BAT-AI uses explainable Artificial Intelligence (AI) to automate repetitive solved problem or routine calculation so we can focus our brain power to solve harder new problem then automate again once it is solved.



This automated calculation is one example of IN-V-BAT- A.I. useful immediately to students, teachers, employees, and parents to help them save time and money.


INVBAT.COM - A.I. + CHATBOT SERVICE
USED IN 207 COUNTRIES


organic growth - no marketing budget



INVBAT.COM - A.I. is a disruptive innovation in computing and web search technology. For example scientific calculator help us speed up calculation but we still need to remember accurately the formula and the correct sequence of data entry. Here comes the disruptive innovation from INVBAT.COM-A.I. , today the problem of remembering formula and the correct sequence of data entry is now solved. How? By combining formula and calculation then make it on demand using smartphone, tablet, notebook, Chromebook, laptop, desktop, school smartboard and company big screen tv in conference room with internet connection, we finally solved the problem of forgetting. Using AI it is now possible to remember our stored knowledge in one click search using voice or text.

How to improve memory recall