
    q~i                     (   S r SSKrSSKrSSKrSSKrSSKJr  \" \5      R                  R                  5       r
\" \
5      \R                  ;  a"  \R                  R                  S\" \
5      5        SSKJr  S
S\S\4S jjrS r\S	:X  a  \" 5         gg)z0Main entry point for the Co-location MVP system.    N)Path)PipelineManager	log_levellog_filec                 x   U(       a;  [         R                  R                  U5      nU(       a  [         R                  " USS9  SnSn[        R
                  " 5       /nU(       a$  UR                  [        R                  " USS95        [        R                  " [        [        U R                  5       5      UUUS9  g)	zfSetup logging configuration.

Args:
    log_level: Logging level
    log_file: Optional log file path
T)exist_okz4%(asctime)s - %(name)s - %(levelname)s - %(message)sz%Y-%m-%d %H:%M:%Szutf-8)encoding)levelformatdatefmthandlersN)ospathdirnamemakedirsloggingStreamHandlerappendFileHandlerbasicConfiggetattrupper)r   r   log_dir
log_formatdate_formatr   s         main.pysetup_loggingr      s     ''//(+KK$/ HJ%K%%'(H++HwGHgy01	    c                     [         R                  " S[         R                  SS9n U R                  S[        SSS9  U R                  S[        S	S
S9  U R                  SSSS9  U R                  S[        S/ SQSS9  U R                  S[        SSS9  U R                  5       n[        UR                  UR                  5        [        R                  " [        5      n UR                  S5        [        UR                  S9nUR                  (       aA  UR                  S5        UR!                  5       n["        R$                  " U(       a  SOS5        g	UR&                  (       aK  UR                  SUR&                   35        UR)                  UR&                  5      nUR+                  U5        g	UR-                  5         g	! [.         a5    UR                  S5        [1        S5        ["        R$                  " S5         g	[2         aA  nUR5                  SU 3S S!9  [1        S"U 35        ["        R$                  " S5         S	nAg	S	nAff = f)#zMain function.u.   交互式 Co-location 模式挖掘系统 (MVP)u   
示例:
  python main.py
  python main.py --config config/config.yaml
  python main.py --query "我更关注高置信度的三阶模式"
        )descriptionformatter_classepilogz--configzconfig/config.yamlu/   配置文件路径 (默认: config/config.yaml))typedefaulthelpz--queryNu'   直接执行查询（非交互模式）z--train
store_trueu   手动触发模型训练)actionr%   z--log-levelINFO)DEBUGr(   WARNINGERRORu   日志级别 (默认: INFO))r#   r$   choicesr%   z
--log-filezlogs/mvp.logu)   日志文件路径 (默认: logs/mvp.log)zInitializing PipelineManager...)config_pathzManual training triggeredr      zProcessing query: zInterrupted by useru   

程序已中断zFatal error: T)exc_infou   错误: )argparseArgumentParserRawDescriptionHelpFormatteradd_argumentstr
parse_argsr   r   r   r   	getLogger__name__infor   configtraintrain_modelsysexitqueryprocess_query_display_resultsrun_pipelineKeyboardInterruptprint	Exceptionerror)parserargsloggermanagersuccessresultes          r   mainrM   0   s   $$D <<	F $>	   6	   '   5*   8	   D $..$--0x(F56!dkk:::KK34))+GHH'Qq)ZZKK,TZZL9:**4::6F$$V,   " )*#$ }QC(48ns,   A5F? AF? .F? ?<I=	I7II__main__)r(   N)__doc__r0   r   r   r<   pathlibr   __file__parentabsoluteproject_rootr4   r   insertcontroller.managerr   r   rM   r7    r   r   <module>rX      s    6   	 
  H~$$--/|CHH$HHOOAs<() /S S :Pf zF r   