Created
August 5, 2023 22:45
-
-
Save Curtis-64/c534aab61a5e576ba2bea7d5cb839538 to your computer and use it in GitHub Desktop.
Language models IQ 3d
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//For Notebook/collab | |
#@title Your Title Here | |
import ipywidgets as widgets | |
from ipywidgets import VBox, Accordion | |
from mpl_toolkits.mplot3d.art3d import Poly3DCollection | |
import matplotlib.pyplot as plt | |
import numpy as np | |
categories = { | |
"Search Engines": (9, 2, 3), | |
"Machine Learning-GPT4": (7, 4, 1), | |
"Deep RL": (2, 7, 2.5), | |
"Humans": (5, 9, 9), | |
"Primates": (3, 6, 7), | |
"Animals": (2, 4, 6), | |
"Bees": (1, 2, 6), | |
"Books": (6, 1, 1), | |
"Programs": (2, 3, 3), | |
"GPT-5+": (8.5, 9, 3), | |
"Data-Star Trek": (9, 6, 7), | |
"Vulcan-Star Trek": (8, 8, 7) | |
} | |
slider_dict = {} | |
category_sliders = [] | |
for key, (x, y, z) in categories.items(): | |
x_slider = widgets.FloatSlider(value=x, min=1, max=10, description=f'{key} (X)') | |
y_slider = widgets.FloatSlider(value=y, min=1, max=10, description=f'{key} (Y)') | |
z_slider = widgets.FloatSlider(value=z, min=1, max=10, description=f'{key} (Z)') | |
category_sliders.append(VBox([x_slider, y_slider, z_slider])) | |
slider_dict[f'{key} (X)'] = x_slider | |
slider_dict[f'{key} (Y)'] = y_slider | |
slider_dict[f'{key} (Z)'] = z_slider | |
box_corners = [(6, 6), (10, 6), (10, 10), (6, 10)] | |
box_sliders = [] | |
for i, (x, y) in enumerate(box_corners): | |
x_slider = widgets.FloatSlider(value=x, min=1, max=10, description=f'Box Corner {i} (X)') | |
y_slider = widgets.FloatSlider(value=y, min=1, max=10, description=f'Box Corner {i} (Y)') | |
box_sliders.append(VBox([x_slider, y_slider])) | |
slider_dict[f'Box Corner {i} (X)'] = x_slider | |
slider_dict[f'Box Corner {i} (Y)'] = y_slider | |
accordion = Accordion(children=[*category_sliders, VBox(box_sliders)]) | |
for i, key in enumerate(categories.keys()): | |
accordion.set_title(i, key) | |
accordion.set_title(len(categories), 'AGI Box Corners') | |
def plot_3d(x_values, y_values, z_values, box_corners): | |
plt.cla() | |
plt.gcf().clear() | |
fig = plt.figure(figsize=(12, 8)) | |
ax = fig.add_subplot(111, projection='3d') | |
ax.scatter(x_values, y_values, z_values, s=100, c='blue') | |
# Adding plumb lines | |
for x, y, z in zip(x_values, y_values, z_values): | |
ax.plot([x, x], [y, y], [0, z], c='gray', linestyle='--') | |
poly3d = [[*corner, 6] for corner in box_corners] + [[*corner, 10] for corner in box_corners] | |
faces = [poly3d[:4], poly3d[4:], [poly3d[0], poly3d[1], poly3d[5], poly3d[4]], | |
[poly3d[1], poly3d[2], poly3d[6], poly3d[5]], [poly3d[2], poly3d[3], poly3d[7], poly3d[6]], | |
[poly3d[3], poly3d[0], poly3d[4], poly3d[7]]] | |
ax.add_collection3d(Poly3DCollection(faces, facecolors='red', linewidths=1, alpha=0.3)) | |
ax.set_xlabel('Declarative Knowledge') | |
ax.set_ylabel('Dynamic Intelligence') | |
ax.set_zlabel('Information Integration') | |
ax.set_xticks(range(1, 11)) | |
ax.set_yticks(range(1, 10)) | |
ax.set_zticks(range(1, 10)) | |
for i, txt in enumerate(categories.keys()): | |
ax.text(x_values[i], y_values[i], z_values[i], txt, fontsize=9) | |
agi_x = sum(corner[0] for corner in box_corners) / 4 | |
agi_y = sum(corner[1] for corner in box_corners) / 4 | |
agi_z = (6 + 10) / 2 | |
ax.text(agi_x, agi_y, agi_z, "AGI", color='black', fontsize=12, ha='center') | |
plt.show() | |
def update_plot(**kwargs): | |
x_values = [kwargs[f'{key} (X)'] for key in categories.keys()] | |
y_values = [kwargs[f'{key} (Y)'] for key in categories.keys()] | |
z_values = [kwargs[f'{key} (Z)'] for key in categories.keys()] | |
box_corners = [[kwargs[f'Box Corner {i} (X)'], kwargs[f'Box Corner {i} (Y)']] for i in range(4)] | |
plot_3d(x_values, y_values, z_values, box_corners) | |
interactive_plot = widgets.interactive_output(update_plot, slider_dict) | |
display(VBox([accordion, interactive_plot])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment