if not os.path.exists("./example_ainalysis"): print( "Run ex00_RUN_THIS_FIRST.py before running any of the example scripts. This creates the required AInalysis." ) sys.exit() # Generate data points without labeling import numpy as np X = np.random.rand(1000, 3) * 20 - 10 # Create PhenoAI instance and load AInalysis from phenoai import PhenoAI from phenoai import logger logger.to_stream(0) master = PhenoAI() master.add("./example_ainalysis", "example") # Predict labeling result = master.run(X) # Output content summary of PhenoAIResults object and AInalysisResults object result.summary() print("") result["example"].summary()
Example 09a and 09c show how to update the entire AInalysis, reusing only the configuration, and how to update the AInalysis checksums respectively. """ # Check if example 08a was run import os if not os.path.exists("./my_first_ainalysis"): raise Exception("The AInalysis 'my_first_ainalysis' as created by example 08a could not be found in the 'examples' folder. Run example 08a to create this AInalysis.") # Load PhenoAI and make sure EVERYTHING is logged to the screen from phenoai import logger from phenoai import maker logger.to_stream(lvl=0) # Create AInalysis maker m = maker.AInalysisMaker( default_id="my_own_classifier", location="./my_updated_first_ainalysis_09b", versionnumber=1, overwrite=True) # Add meta information m.set_about("Test AInalysis from example09b", "This AInalysis is created by the 08a example and serves no purpose other than showcasing how AInalyses are made. Only the meta information (this about file) should be different from the 08a AInalysis.") m.add_author("Bob Stienen", "*****@*****.**") m.add_author("Sascha Caron", "*****@*****.**")
from phenoai import logger # Send the output to the screen # lvl indicates the minimum level output should have to be printed. The higher the # level, the higher its importance. Conventions follow those of the native logging # module of python: # 10 DEBUG # 20 INFO # 30 WARNING # 40 ERROR # 50 CRITICAL # The setting below indicates that all messages with an importance of INFO or # higher will be printed logger.to_stream(lvl=20) # Send output to file. The level of this output channel may differ from the lvl # for the stream channel. Only a single filechannel can exist at a time. logger.to_file("loggertest.out", lvl=0) # Output a couple of messages logger.debug("debug message") logger.info("yo") logger.warning("warning message") logger.error("this is an error") logger.critical("HELP!") # Colour the output messages for the stream channel. The file channel is