Name nicht aufgelöst: Der Spaltenname wird nicht aufgelöst, wenn ich ihn als Wert in einer Liste angebeIch versuche, die AUC für jede Spalte in einer Datentabelle zu berechnen. Ich sammle alle Spaltennamen in einer Liste „colNamesList“ und rufe jeden Spaltennamen in „Fit Model“ innerhalb einer For-Schleife ab, indem ich den Listenindex erhöhe. Der Aufruf des Arrays wird jedoch innerhalb des Fit Model-Aufrufs nicht aufgelöst.Wenn ich show(colNamesList[i]) in einer separaten Zeile einfüge, wird es gut aufgelöst, nur nicht innerhalb des Fit Model-Aufrufs. Ich verwende ein Skript aus einem früheren Beitrag in diesem Forum und vermute, dass meine ältere Version von JMP (Version 9.0.0) nur eine etwas andere Syntax benötigt. Alle Ideen wären willkommen.
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;
);
Der Fehler im Protokoll lautet wie folgt:
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;
);Automatisierung und SkripterstellungWindowsBetreff: Name nicht aufgelöst: Der Spaltenname wird nicht aufgelöst, wenn ich ihn als Wert in einer Liste angebe- Der Grund dafür, dass der Name nicht aufgelöst wurde, liegt darin, dass Sie die Liste „colNamesList“ genannt und als „colNameLise“ darauf verwiesen haben.
- Der AUC-Wert muss in einer definierten Zeile platziert werden, daher müssen Sie das Suskript zu dtOutput:AUC hinzufügen
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;
);
Betreff: Name nicht aufgelöst: Der Spaltenname wird nicht aufgelöst, wenn ich ihn als Wert in einer Liste angebeJa, das war ein Tippfehler und die Behebung war Teil der Lösung. Vielen Dank, dass Sie das gesehen haben. Ich erhielt immer noch die Fehlermeldung „Spalte {1} konnte nicht gefunden werden“, die durch Verweisen auf die Datentabelle bei der Angabe der Spalte behoben wurde: Column(dt, colNamesList[i]) anstelle von Column(colNamesList[i]). Dann erhielt ich die Fehlermeldung „Antwort sollte auch kein Faktor sein, ^1case“, also fügte ich eine IF-Anweisung hinzu, um die Antwortspalte zu ignorieren.Dies lief unabhängig davon, ob ich den Index zu AUC hinzugefügt habe.
Hier ist also mein erstes JSL-Skript. Eine ziemliche Lernerfahrung. Vielen Dank an txnelson für Ihre Hilfe!
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;
);Betreff: Name nicht aufgelöst: Der Spaltenname wird nicht aufgelöst, wenn ich ihn als Wert in einer Liste angebeGut gemacht!
Sie können die Fehlerreaktion vermeiden, indem Sie die Zeile in ändern
try(Report( theLog ) << close window);
Sie können die JSL auch verkürzen und effizienter ausführen, indem Sie die doppelten Zuweisungen zu einer einzelnen Anweisung entfernen
colName = dtOutput:var_name[i] = colNamesList[i];