Skip to content

neurostatx.cli.LogisticRegression

Attributes

NameDescription
appCyclopts application for the LogisticRegression command-line tool.

Functions

NameDescription
LogisticRegressionFit logistic regression of graph edges against node attributes.

appattributemodule attribute#

app = App(default_parameter=Parameter(negative=()))

Cyclopts application for the LogisticRegression command-line tool.

LogisticRegressionfunction#

def LogisticRegression(in_graph: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], out_folder: Annotated[str, Parameter(show_default=False, group='Essential Files Options')], attributes: Annotated[List[str], Parameter(group='Model Parameters', show_default=False)], covariates: Annotated[List[str], Parameter(group='Model Parameters', show_default=True)] = None, weight: Annotated[str, Parameter(group='Model Parameters', show_default=True)] = 'membership', splits: Annotated[int, Parameter(group='Model Parameters', show_default=True)] = 10, test_size: Annotated[float, Parameter(group='Model Parameters', show_default=True)] = 0.2, cs: Annotated[int, Parameter(group='Model Parameters', show_default=True)] = 10, max_iter: Annotated[int, Parameter(group='Model Parameters', show_default=True)] = 1000, penalty: Annotated[Penalty, Parameter(group='Model Parameters', show_default=True, show_choices=True)] = Penalty.l2, solver: Annotated[Solver, Parameter(group='Model Parameters', show_default=True, show_choices=True)] = Solver.lbfgs, permutations: Annotated[int, Parameter(group='Model Parameters', show_default=True)] = 1000, scoring: Annotated[ScoringMethod, Parameter(group='Model Parameters', show_default=True)] = ScoringMethod.r2, processes: Annotated[int, Parameter(group='Model Parameters', show_default=True)] = 1, plot_distributions: Annotated[bool, Parameter(show_default=True, group='Visualization Options')] = False, verbose: Annotated[bool, Parameter(-v, --verbose, group='Optional parameters')] = False, save_parameters: Annotated[bool, Parameter(-s, --save_parameters, group='Optional parameters')] = False, overwrite: Annotated[bool, Parameter(-f, --overwrite, group='Optional parameters')] = False)

Fit logistic regression of graph edges against node attributes.

LogisticRegression uses edge weights as predictors and node attributes as the response. It cross-validates on a training set, tests on held-out data, then runs permutation testing for statistical significance. It writes coefficients, statistics, and plots of attribute and edge-weight distributions and of the coefficients.

Parameters

NameTypeDefaultDescription
in_graphstrrequiredGraph file containing the data for the model.
out_folderstrrequiredOutput folder.
attributesList[str]requiredAttribute names to include in the model. Must be present in the graph file. At least one attribute is required.
covariatesList[str]NoneCovariates to include in the model. Must be present in the graph file. Defaults to None.
weightstr'membership'Edge weight to use for the model. Defaults to membership.
splitsint10Number of splits to use for the cross-validation. Defaults to 10.
test_sizefloat0.2Size of the testing set. Must be between 0 and 1. Defaults to 0.2.
csint10Inverse of regularization strength. Smaller values specify stronger regularization. Defaults to 10.
max_iterint1000Maximum number of iterations for the solver. Defaults to 1000.
penaltyPenaltyPenalty.l2Regularization penalty to use for the LogisticRegression model. Defaults to l2.
solverSolverSolver.lbfgsSolver to use for the LogisticRegression model. Defaults to lbfgs.
permutationsint1000Number of permutations to use for the permutation testing. Defaults to 1000.
scoringScoringMethodScoringMethod.r2Scoring method to use for the permutation testing. Defaults to r2.
processesint1Number of processes to use for the cross-validation. Defaults to 1.
plot_distributionsboolFalseIf true, will plot the distributions of the edges’ weights. Defaults to False.
verboseboolFalseIf true, produce verbose output. Defaults to False.
save_parametersboolFalseIf true, will save input parameters to .txt file. Defaults to False.
overwriteboolFalseIf true, force overwriting of existing output files. Defaults to False.

Examples

Terminal window
LogisticRegression --in-graph graph.gexf --out-folder output_folder -v
-s