Nouvelle publication

Rechercher

Question
· Juil 7, 2024

Cómo entrenar "realmente" un modelo de aprendizaje automático

Hola a todos,

Hace unos días vi a un youtuber hablando de cómo crear una red neuronal (en español)

En resumen, utiliza la red neuronal para aprender a convertir grados Celsius a grados Fahrenheit.
Grados Fahrenheit= (Grados  Celsius × 9/5) +32

En este vídeo utiliza Python para crear la red neuronal, donde crea una tabla con los valores de grados Celsius y grados Fahrenheit.
Luego hace 1000 entrenamientos al modelo que ha creado, cuando consulta la predicción a un valor que no está en la tabla que ha utilizado para entrenar, le da un valor correcto (o bastante cercano).

Bueno, quería hacer el mismo ejemplo usando IRIS e Intersystems IntegratedML, así que creé una tabla con los dos valores y siguiendo las instrucciones de "Introducción al aprendizaje automático"

Class St.MLL.celsiusFahrenheit Extends %Persistent
{

/// Value of Celsius
Property Celsius As %Decimal;
/// Value of Fahrenheit
Property Fahrenheit As %Decimal;
/// Populate table
ClassMethod Populate() As %Status
{
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(-40,-40))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(-10,14))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(0,32))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(8,46))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(15,59))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(22,72))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(38,100))
    Return $$$OK
}

ClassMethod Training() As %Status
{
    write "Creating model celsiusFahrenheitModel",!
    &sql(CREATE MODEL celsiusFahrenheitModel PREDICTING (Fahrenheit) FROM St_MLL.celsiusFahrenheit)
    write "Training model",!
    for i=1:1:100
    {
        &sql(TRAIN MODEL celsiusFahrenheitModel As FirstModel)
        write "Step "_i_" of 100",!
    }
    write "Validate model celsiusFahrenheitModel",!
    &sql(VALIDATE MODEL celsiusFahrenheitModel FROM St_MLL.celsiusFahrenheit)
}

}

Hice lo mismo, entrenando el modelo 100 veces.

He creado otra tabla con los valores para probar el modelo.

Class St.MLL.celsiusTest Extends %Persistent
{

/// Value of Celsius
Property Celsius As %Decimal;
/// Value of Fahrenheit
Property Fahrenheit As %Decimal;
/// Populate table
ClassMethod Populate() As %Status
{
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(10,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(20,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(30,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(40,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(50,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(60,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(70,0))
    Return $$$OK
}
}

Pero no parece funcionar porque siempre devuelve el mismo valor de predicción.

USER > do ##class(St.MLL.celsiusFahrenheit).Populate()
USER > do ##class(St.MLL.celsiusFahrenheit).Training()
Creating model celsiusFahrenheitModel
Training model
Step 1 of 100
Step 2 of 100
Step 3 of 100
Step 4 of 100
......
Step 99 of 100
Step 100 of 100
Validate model celsiusFahrenheitModel
USER > do ##class(St.MLL.celsiusTest).Populate()
USER >

Estaba esperando:

Celisu Fahrenheit prediction
10 0 50
20 0 68
30 0 86
40 0 104
50 0 122
60 0 140
70 0 158

Creí que, una vez entrenado el modelo, podría predecir qué valor le corresponde, porque no sabemos cuál es el valor en Fahrenheit.
¿Qué se está haciendo mal? ¿Estoy intentando hacer algo que no es posible? Es decir, que mi modelo aprenda cuál es el patrón y yo solo tengo que preguntar el valor de la predicción de mi modelo según el valor de los grados centígrados.

Muchas gracias

2 Comments
Discussion (2)1
Connectez-vous ou inscrivez-vous pour continuer
Question
· Juil 7, 2024

How to "real" training a machine learning model

Hi all,

Some days ago, I've seen a youtuber talking about how to create a neural network (sorry, is in spanish)

In short, it uses the neural network to learn how to convert degrees Celsius to degrees Fahrenheit.
Degrees Fahrenheit = (degrees Celsius × 9/5) +32
In this video, he uses Python to create the neural network, where he creates a table with the values ​​of degrees Celsius and degrees Fahrenheit.
Then he does 1000 trainings to the model that he has created, when he consults the prediction at a value that is not in the table that he has used to train, it gives a correct (or fairly close) value.

Well, I wanted to do the same example using IRIS and Intersystems IntegratedML, so I created a table with the two values, and following the instructions in "Introduction to machine learning

Class St.MLL.celsiusFahrenheit Extends %Persistent
{

/// Value of Celsius
Property Celsius As %Decimal;
/// Value of Fahrenheit
Property Fahrenheit As %Decimal;
/// Populate table
ClassMethod Populate() As %Status
{
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(-40,-40))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(-10,14))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(0,32))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(8,46))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(15,59))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(22,72))
    &sql(INSERT INTO St_MLL.celsiusFahrenheit VALUES(38,100))
    Return $$$OK
}

ClassMethod Training() As %Status
{
    write "Creating model celsiusFahrenheitModel",!
    &sql(CREATE MODEL celsiusFahrenheitModel PREDICTING (Fahrenheit) FROM St_MLL.celsiusFahrenheit)
    write "Training model",!
    for i=1:1:100
    {
        &sql(TRAIN MODEL celsiusFahrenheitModel As FirstModel)
        write "Step "_i_" of 100",!
    }
    write "Validate model celsiusFahrenheitModel",!
    &sql(VALIDATE MODEL celsiusFahrenheitModel FROM St_MLL.celsiusFahrenheit)
}

}

I've done the same, training the model 100 times.

I've created other table with the values to test the model

Class St.MLL.celsiusTest Extends %Persistent
{

/// Value of Celsius
Property Celsius As %Decimal;
/// Value of Fahrenheit
Property Fahrenheit As %Decimal;
/// Populate table
ClassMethod Populate() As %Status
{
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(10,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(20,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(30,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(40,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(50,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(60,0))
    &sql(INSERT INTO St_MLL.celsiusTest VALUES(70,0))
    Return $$$OK
}
}

But it doesn't seem to work, because it always returns the same prediction value.

USER > do ##class(St.MLL.celsiusFahrenheit).Populate()
USER > do ##class(St.MLL.celsiusFahrenheit).Training()
Creating model celsiusFahrenheitModel
Training model
Step 1 of 100
Step 2 of 100
Step 3 of 100
Step 4 of 100
......
Step 99 of 100
Step 100 of 100
Validate model celsiusFahrenheitModel
USER > do ##class(St.MLL.celsiusTest).Populate()
USER >

I was expecting:

Celisu Fahrenheit prediction
10 0 50
20 0 68
30 0 86
40 0 104
50 0 122
60 0 140
70 0 158

I believed that, once the model was trained, it could predict what value corresponds to it, because we do not know what the value is in Fahrenheit.
What is being done wrong? Am I trying to do something that is not possible? That is, have my model learn what the pattern is and I only have to ask for the value of my model's prediction according to the value of degrees Celsius.

Best regards

4 Comments
Discussion (4)2
Connectez-vous ou inscrivez-vous pour continuer
Question
· Juil 7, 2024

%SYSTEM. How to end the corresponding lock process after WorkManager reports an error

hi guys!

while  WorkMgr.Queue reports a error,  there are many locks, how to deal it?

Discussion (0)1
Connectez-vous ou inscrivez-vous pour continuer
Article
· Juil 7, 2024 1m de lecture

批量终止包含某个Routine的进程

问题:锁管理里边包含很多WorkQueueMgr的锁,我想批量去移除,比较多,一个一个移除比较慢

解决:查询所有的进程,过滤routine不包含某个routine的进程,进行终止

代码:

ClassMethod BatchTerminalProcessQuery()
{     Set Rset = ##class(%ResultSet).%New("%SYS.ProcessQuery:ListPids")
Rset.Execute()
While Rset.Next() {
   CurrentLineAndRoutine=""
   &sql(SELECT CurrentLineAndRoutine INTO :CurrentLineAndRoutine FROM %SYS.ProcessQuery WHERE Pid = :Rset.GetData(1))
   continue:CurrentLineAndRoutine'[".WorkQueueMgr"
   CurrentLineAndRoutine,!
   pid=Rset.GetData(1)
   sc= $System.Process.Terminate(pid)
   sc,!
   ;w $ZU(4,pid,1)
}
Rset.Close()
}

1 Comment
Discussion (1)1
Connectez-vous ou inscrivez-vous pour continuer
Question
· Juil 6, 2024

2016.2.3 ensemble portal进不去,IIS和terminal和studio都好使Server Availability Error,有人遇到过么?

csp.log日志是这个

2 Comments
Discussion (2)1
Connectez-vous ou inscrivez-vous pour continuer