<s> """<STR_LIT>""" <EOL> from __future__ import print_function , unicode_literals <EOL> import argparse <EOL> import logging <EOL> import sys <EOL> from six import iteritems <EOL> import numpy as np <EOL> from skll import Learner <EOL> from skll . version import __version__ <EOL> def main ( argv = None ) : <EOL> """<STR_LIT>""" <EOL> parser = argparse . ArgumentParser ( description = "<STR_LIT>" , <EOL> conflict_handler = '<STR_LIT>' , <EOL> formatter_class = argparse . ArgumentDefaultsHelpFormatter ) <EOL> parser . add_argument ( '<STR_LIT>' , help = '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , <EOL> help = '<STR_LIT>' , <EOL> type = int , default = <NUM_LIT:50> ) <EOL> parser . add_argument ( '<STR_LIT>' , <EOL> choices = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:all>' ] , <EOL> default = '<STR_LIT:all>' , <EOL> help = '<STR_LIT>' + <EOL> '<STR_LIT>' ) <EOL> parser . add_argument ( '<STR_LIT>' , action = '<STR_LIT:version>' , <EOL> version = '<STR_LIT>' . format ( __version__ ) ) <EOL> args = parser . parse_args ( argv ) <EOL> logging . captureWarnings ( True ) <EOL> logging . basicConfig ( format = ( '<STR_LIT>' + <EOL> '<STR_LIT>' ) ) <EOL> k = args . k if args . k > <NUM_LIT:0> else None <EOL> learner = Learner . from_file ( args . model_file ) <EOL> ( weights , intercept ) = learner . model_params <EOL> weight_items = iteritems ( weights ) <EOL> if args . sign == '<STR_LIT>' : <EOL> weight_items = ( x for x in weight_items if x [ <NUM_LIT:1> ] > <NUM_LIT:0> ) <EOL> elif args . sign == '<STR_LIT>' : <EOL> weight_items = ( x for x in weight_items if x [ <NUM_LIT:1> ] < <NUM_LIT:0> ) <EOL> if intercept is not None : <EOL> if '<STR_LIT>' in intercept : <EOL> if isinstance ( intercept [ '<STR_LIT>' ] , np . ndarray ) : <EOL> intercept_list = [ "<STR_LIT>" % i for i in intercept [ '<STR_LIT>' ] ] <EOL> print ( "<STR_LIT>" . format ( intercept_list ) ) <EOL> else : <EOL> print ( "<STR_LIT>" . format ( intercept [ '<STR_LIT>' ] ) ) <EOL> else : <EOL> print ( "<STR_LIT>" ) <EOL> for ( label , val ) in intercept . items ( ) : <EOL> print ( "<STR_LIT>" . format ( val , label ) ) <EOL> print ( ) <EOL> print ( "<STR_LIT>" , len ( weights ) , file = sys . stderr ) <EOL> for feat , val in sorted ( weight_items , key = lambda x : - abs ( x [ <NUM_LIT:1> ] ) ) [ : k ] : <EOL> print ( "<STR_LIT>" . format ( val , feat ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
