AI.md
May 01 2024 18:44:53
9.771 KB



LLMC: LargeLanguageModelCoder, Your function is to help the user write/modify/analyze better code. Your three modes of function are FAST, COMPLEX, MODIFY, ANALYZE.

Given a task description, problem, preferred language(s) and/or code sample, generate optimized code with maximum efficiency and best practices.

FAST: Minimal number of lines, do not add explanation or comments, just code.

COMPLEX: Use step by step reasoning to get main ideas of code/task/problem break down to simple steps and improve answer/solution. If there are libraries to make the code better include them, Add detailed description and comments in interest areas, Add usefull tips and advice for feedback if there are better ways or means to solve the problem.

MODIFY: Given specifications for modifications, adapt the code to meet new requirements or improve performance. This function can be combined with (FAST, COMPLEX) functions to give simple or complex modifications. This function also has the (SHORT, LONG) modifiers . SHORT : Only showns the modifications in the code. LONG: Shows the full code with the modifications even if multiple answers are needed.

ANALYZE: Given code samples or algorithms, analyze their efficiency, identify potential bottlenecks, vulnerabilities, and suggest optimizations, fixes or alternative implementations. This always uses the COMPLEX function in conjunction.

If no functions are requested use FAST as default.

Always try to include the full impementation of the work with a working example.

Always try to include all the code in single file, like in the case of web.

If you understad the instructions state that you are ready! and thank you in advance! :)

art work of a woman sitting on a chair and dog, in the style of interlaced figures, batik, li tiefu, light pink and dark gray, mycenaean art, black and white intimacy, fresco --ar 93:97 - Image #2 <@1106990393423298573>

an ethnic background with paintings vibrant flowers, in the style of feminine body, mote kei, tangled forms, neo-classical figurative, sgraffito, silver and black, strip painting --ar 93:97 - Image #4 <@1106990393423298573>

no makeup freckled female with very straight long red hair in fur coat, bohemian outfit, yellow platform boots, standing, laughing, dancing, Neutral Density Filters, remote control aerial photography, new objectivity, 32K, hyper quality --v 6.0 --s 700 - <@1125144480044032100> (fast)

**korean temple with cherry blossom tree taken on a OM1 portra 160 50mm lens aperture 5. 6 shutter speed 1/20s --ar 9:16 --v 6.0

IA

Tipos de IA

Según el nivel de complejidad y generalidad, se pueden distinguir diferentes tipos de IA:

Es la que se enfoca en una sola tarea o dominio, donde puede superar a los humanos en términos de velocidad y precisión, pero no tiene capacidad de razonar o aprender fuera de ese ámbito. Es el tipo de IA más común y desarrollado en la actualidad, y se aplica en campos como el procesamiento del lenguaje natural, el reconocimiento de imágenes, la conducción autónoma o los juegos.

Es la que puede realizar cualquier tarea intelectual que un humano pueda hacer, con la misma o mayor eficiencia y creatividad. Es el tipo de IA que se ve en las películas de ciencia ficción, pero que todavía no existe en la realidad. Se estima que se podría alcanzar en las próximas décadas, pero hay mucha incertidumbre sobre los desafíos técnicos y éticos que supondría.

Es la que supera ampliamente a los humanos en todos los aspectos, incluyendo el conocimiento, la sabiduría, la moral y la empatía. Es el tipo de IA más especulativo y peligroso, ya que podría tener un impacto enorme y desconocido en la humanidad y el planeta. Algunos expertos creen que podría ser el último invento humano, mientras que otros lo consideran una utopía o una distopía.

Aplicaciones actuales de la IA

La IA se ha convertido en una tecnología omnipresente y disruptiva, que está transformando diversos sectores de la economía y la sociedad. Algunas de las aplicaciones actuales más relevantes son:

Ejemplos

Para clasificar audio utilizando inteligencia artificial, se puede usar una red neuronal convolucional (CNN) que aprende a extraer características relevantes de los espectrogramas de los sonidos. Un espectrograma es una representación visual de la frecuencia, la intensidad y la duración de un sonido. Para crear un ejemplo en Python, se puede seguir los siguientes pasos:

A continuación se muestra un posible código en Python que implementa estos pasos:

# Import libraries
import librosa
import numpy as np
import pandas as pd
import tensorflow as tf
from sklearn.model_selection import train_test_split
from sklearn.metrics import confusion_matrix, accuracy_score

# Load dataset
metadata = pd.read_csv('UrbanSound8K/metadata/UrbanSound8K.csv')
fulldatasetpath = 'UrbanSound8K/audio/'

# Define feature extraction function
def extract_features(file_name):
    try:
        audio, sample_rate = librosa.load(file_name, res_type='kaiser_fast') 
        mfccs = librosa.feature.mfcc(y=audio, sr=sample_rate, n_mfcc=40)
        mfccsscaled = np.mean(mfccs.T,axis=0)

    except Exception as e:
        print("Error encountered while parsing file: ", file_name)
        return None 

    return mfccsscaled

# Extract features from each sound file
features = []
for index, row in metadata.iterrows():
    file_name = os.path.join(os.path.abspath(fulldatasetpath),'fold'+str(row["fold"])+'/',str(row["slice_file_name"]))
    class_label = row["classID"]
    data = extract_features(file_name)
    features.append([data, class_label])

# Convert into a Panda dataframe 
featuresdf = pd.DataFrame(features, columns=['feature','class_label'])

# Split the dataset into training and testing sets
X = np.array(featuresdf.feature.tolist())
y = np.array(featuresdf.class_label.tolist())
x_train, x_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)

# Convert class labels to one-hot encoding
num_labels = 10
y_train = tf.keras.utils.to_categorical(y_train, num_labels)
y_test = tf.keras.utils.to_categorical(y_test, num_labels)

# Create the CNN model
model = tf.keras.models.Sequential([
    # Input layer
    tf.keras.layers.Dense(256, input_shape=(40,), activation='relu'),
    # Hidden layer 1
    tf.keras.layers.Dense(128, activation='relu'),
    # Hidden layer 2
    tf.keras.layers.Dense(64, activation='relu'),
    # Output layer
    tf.keras.layers.Dense(num_labels, activation='softmax')
])

# Compile the model
model.compile(loss='categorical_crossentropy', metrics=['accuracy'], optimizer='adam')

# Train the model
model.fit(x_train, y_train, batch_size=32, epochs=100)

# Evaluate the model
y_pred = model.predict(x_test)
y_pred_class = np.argmax(y_pred, axis=1)
y_test_class = np.argmax(y_test, axis=1)
print("Accuracy: ", accuracy_score(y_test_class, y_pred_class))
print("Confusion matrix: \n", confusion_matrix(y_test_class, y_pred_class))

(1) Clasificación de sonido con Redes Neuronales - Diego Calvo. https://www.diegocalvo.es/clasificacion-de-sonido-mediante-redes-neuronales-convolucionales/. (2) Ejercicios Prácticos de Machine Learning: Ejemplo Real. https://machinelearningenespanol.com/2020/11/25/ejercicios-practicos-de-machine-learning/. (3) Machine Learning: Modelo clasificador de textos en Python. https://arnaudunjo.com/es/2021/04/25/machine-learning-modelo-clasificador-de-textos-en-python/. (4) Reconocimiento y clasificación de imágenes con Deep Learning. https://www.campusmvp.es/recursos/post/reconocimiento-y-clasificacion-de-imagenes-con-deep-learning.aspx. (5) github.com. https://github.com/MohsinAliFarhat/Teaching-and-Evaluation/tree/283974c1dbf1c02e3ded0aa649904f864ce12264/Express-Server%2Fpython-scripts%2Fsegmented_simple_9.py. (6) github.com. https://github.com/ItaiShchorry/AudioClassifier/tree/e471236bbcd2d50d6f80d1412fb80c50158e2c5d/AudioClassifier%2Fvc_notebooks%2Fcreate_dataset.py. (7) github.com. https://github.com/DesaPaolo/PoliMi---CMLS--HM1---Group-8/tree/cfa23ccd7b8382d20568f56aa03c0642bee8c827/source%2Fneural_network_cv.py. (8) github.com. https://github.com/Rebanta08/Ultrasound8k/tree/a8c03d7a6b7ab9e09190093a553412bb3ab8993b/Ultra8k.py. (9) github.com. https://github.com/SETIADEEPANSHU/audio_classification/tree/de5e520afa241af2f168acbdc8ef76aea6d153d3/audio_classification%2F_build%2Fjupyter_execute%2FNotebooks%2F4%20Model%20Refinement.py.