Nom non résolu : le nom de la colonne ne sera pas résolu lorsque je le spécifierai comme valeur dans une listeJ'essaie de calculer l'AUC pour chaque colonne d'un tableau de données. Je rassemble tous les noms de colonnes dans une liste "colNamesList" et je récupère chaque nom de colonne dans Fit Model à l'intérieur d'une boucle For en incrémentant l'indice de la liste. Cependant, l’appel au tableau n’est pas résolu dans l’appel Fit Model.Si j'inclus show(colNamesList[i]) sur une ligne distincte, cela se résout correctement, mais pas dans l'appel Fit Model. J'utilise un script provenant d'un article précédent sur ce forum et je soupçonne que mon ancienne version de JMP (version 9.0.0) a simplement besoin d'une syntaxe légèrement différente. Toute idée serait appréciée.
Names Default To Here( 1 );
// Open and example data table
dt = Open( "sample.jmp" );
// Get the columns to be analyzed
colNamesList = dt << get column names( string );
// Create a data table to save the results to
dtOutput = New Table( "Results", New Column( "var_name", character ), New Column( "AUC", character ) );
// Loop across all of the columns to be analyzed and retrieve the AUC
For( i = 1, i <= N Items( colNamesList ), i++,
// Add a new row to the output data table
dtOutput << Add Rows( 1 );
// Add the active variable name to the current row in the data table
dtOutput:var_name[i] = colNamesList[i];
// Run the Logistic Regression
theLog = dt << Fit Model(invisible, Y( :case ),Effects( column (colNameList[i]) ),Personality( Nominal Logistic ),Run(Positive Level( "1" ),Likelihood Ratio Tests( 1 ),ROC Curve( 1 ),));
// Add the AUC to the data table by grabbing it from the display report output
dtOutput:AUC = (Report( theLog )["Receiver Operating Characteristic"][numberbox(1)] << get text);
// Close the report window
Report( theLog ) << close window;
);
L'erreur dans le journal est la suivante :
Name Unresolved: colNameList{1}
in access or evaluation of 'colNameList' , colNameList
Exception in platform launch{1}
in access or evaluation of 'Fit Model' , Fit Model(
invisible,
Y( :case ),
Effects( Column( colNameList[i] ) ),
Personality( Nominal Logistic ),
Run( Positive Level( "1" ), Likelihood Ratio Tests( 1 ), ROC Curve( 1 ) )
)
In the following script, error marked by /*###*/
Fit Model(
invisible,
Y( :case ),
Effects( Column( colNameList/*###*/[i] ) ),
Personality( Nominal Logistic ),
Run( Positive Level( "1" ), Likelihood Ratio Tests( 1 ), ROC Curve( 1 ) )
)
Cannot subscript Display Box{1}
in access or evaluation of 'Subscript' , Report( theLog )["Receiver Operating Characteristic"]
In the following script, error marked by /*###*/
Names Default To Here( 1 );
dt = Open( "sample.jmp" );
colNamesList = dt << get column names( string );
dtOutput = New Table( "Results",
New Column( "var_name", character ),
New Column( "AUC", character )
);
For( i = 1, i <= N Items( colNamesList ), i++,
dtOutput << Add Rows( 1 );
dtOutput:var_name[i] = colNamesList[i];
theLog = dt << Fit Model(/*###*/invisible,
Y( :case ),
Effects( Column( colNameList[i] ) ),
Personality( Nominal Logistic ),
Run( Positive Level( "1" ), Likelihood Ratio Tests( 1 ), ROC Curve( 1 ) )
);
dtOutput:AUC = Report( theLog )[/*###*/"Receiver Operating Characteristic"][
numberbox( 1 )] << get text;
Report( theLog ) << close window;
);Automatisation et scriptsles fenêtresRe : Nom non résolu : le nom de la colonne ne sera pas résolu lorsque je le spécifierai comme valeur dans une liste- La raison pour laquelle le nom n'était pas résolu est que vous avez appelé la liste, colNamesList, et que vous l'avez référencée comme colNameLise.
- La valeur AUC doit être placée sur une ligne définie, vous devez donc ajouter l'indice à dtOutput:AUC
Names Default To Here( 1 );
// Open and example data table
dt = Open( "sample.jmp" );
// Get the columns to be analyzed
colNamesList = dt << get column names( string );
// Create a data table to save the results to
dtOutput = New Table( "Results", New Column( "var_name", character ), New Column( "AUC", character ) );
// Loop across all of the columns to be analyzed and retrieve the AUC
For( i = 1, i <= N Items( colNamesList ), i++,
// Add a new row to the output data table
dtOutput << Add Rows( 1 );
// Add the active variable name to the current row in the data table
dtOutput:var_name[i] = colNamesList[i];
// Run the Logistic Regression
theLog = dt << Fit Model(
invisible,
Y( :case ),
Effects( Column( colNamesList[i] ) ),
Personality( Nominal Logistic ),
Run( Positive Level( "1" ), Likelihood Ratio Tests( 1 ), ROC Curve( 1 ) )
);
// Add the AUC to the data table by grabbing it from the display report output
dtOutput:AUC[i] = (Report( theLog )["Receiver Operating Characteristic"][numberbox( 1 )] << get text);
// Close the report window
Report( theLog ) << close window;
);
Re : Nom non résolu : le nom de la colonne ne sera pas résolu lorsque je le spécifierai comme valeur dans une listeOui, c'était une faute de frappe et la corriger faisait partie de la solution, alors merci d'avoir vu cela. J'obtenais toujours une erreur « impossible de trouver la colonne {1} », résolue en faisant référence à la table de données lors de la spécification de la colonne : Column(dt, colNamesList[i]) au lieu de Column(colNamesList[i]). Ensuite, j'ai eu l'erreur "La réponse ne devrait pas non plus être un facteur, ^1case", j'ai donc ajouté une instruction IF pour ignorer la colonne de réponse.Cela fonctionnait si j'ajoutais l'indice à l'AUC.
Voici donc mon premier script jsl. Toute une expérience d’apprentissage. Merci à txnelson pour votre aide !
Names Default To Here( 1 );
// Open and example data table
dt = Open( "sample.jmp" );
// Get the columns to be analyzed
colNamesList = dt << get column names( string );
// Create a data table to save the results to
dtOutput = New Table( "Results", New Column( "var_name", character ), New Column( "AUC", character ) );
// Loop across all of the columns to be analyzed and retrieve the AUC
For( i = 1, i <= N Items( colNamesList ), i++,
// Add a new row to the output data table
dtOutput << Add Rows( 1 );
// Add the active variable name to the current row in the data table
dtOutput:var_name[i] = colNamesList[i];
//Get the next column name
colName = colNamesList[i];
// If the column is "case", leave AUC blank, otherwise run the Logistic Regression
if(colName=="case", AUC=.,
theLog = dt << Fit Model(
invisible,
Y(:case),
Effects(column(dt,colName)),
Personality( Nominal Logistic ),
Run(
Positive Level( "1" ),
Likelihood Ratio Tests( 1 ),
ROC Curve( 1 ),
)
);
// Add the AUC to the data table by grabbing it from the display report output
dtOutput:AUC[i] = (Report( theLog )["Receiver Operating Characteristic"][numberbox(1)] << get text);
);
// Close the report window
Report( theLog ) << close window;
);Re : Nom non résolu : le nom de la colonne ne sera pas résolu lorsque je le spécifierai comme valeur dans une listeBon travail!
Vous pouvez éviter la réponse d'erreur en modifiant la ligne en
try(Report( theLog ) << close window);
Vous pouvez également raccourcir et rendre le JSL plus efficace en supprimant les affectations en double dans une seule instruction.
colName = dtOutput:var_name[i] = colNamesList[i];