def main(): bi.init("Docs Json", "../../../h2o-docs", clear_dir=False) bi.vprint("Writing schemas.json...") bi.write_to_file("schemas.json", json.dumps(bi.schemas(raw=True))) bi.vprint("Writing routes.json...") bi.write_to_file("routes.json", json.dumps(bi.endpoints(raw=True)))
def main(): bi.init("Thrift", "thrift") schemas_map = bi.schemas_map() ordered_schemas = OrderedDict() for name, schema in schemas_map.items(): add_schema_to_dependency_array(schema, ordered_schemas, schemas_map) bi.write_to_file("water/bindings/structs/H2O.thrift", generate_thrift(ordered_schemas)) type_adapter.vprint_translation_map()
def main(): bi.init("Python", "python") for name, mb in bi.model_builders().items(): module = name if name == "drf": module = "random_forest" if name == "naivebayes": module = "naive_bayes" bi.vprint("Generating model: " + name) bi.write_to_file("%s.py" % module, gen_module(mb, name)) type_adapter.vprint_translation_map()
def main(): bi.init("C#", "CSharp") for schema in bi.schemas(): name = schema["name"] bi.vprint("Generating schema: " + name) bi.write_to_file("h2o/%s.cs" % name, generate_schema(name, schema)) for name, values in bi.enums().items(): bi.vprint("Generating enum: " + name) bi.write_to_file("h2o/%s.cs" % name, generate_enum(name, sorted(values))) type_adapter.vprint_translation_map()
def main(): bi.init("Python", "../../../h2o-py/h2o/estimators", clear_dir=False) modules = [("deeplearning", "H2OAutoEncoderEstimator")] # deeplearning module contains 2 classes in it... for name, mb in bi.model_builders().items(): module = name if name == "drf": module = "random_forest" if name == "naivebayes": module = "naive_bayes" bi.vprint("Generating model: " + name) bi.write_to_file("%s.py" % module, gen_module(mb, name)) modules.append((module, algo_to_classname(name))) bi.write_to_file("__init__.py", gen_init(modules)) type_adapter.vprint_translation_map()
def main(): bi.init("R", "../../../h2o-r/h2o-package/R", clear_dir=False) for name, mb in bi.model_builders().items(): if name in ["aggregator"]: continue module = name file_name = name if name == "drf": module = "randomForest" file_name = "randomforest" if name == "naivebayes": module = "naiveBayes" if name == "stackedensemble": module = "stackedEnsemble" if name == "pca": module = "prcomp" bi.vprint("Generating model: " + name) bi.write_to_file("%s.R" % file_name, gen_module(mb, name, module))
def main(): bi.init("Java", "java") for schema in bi.schemas(): name = schema["name"] bi.vprint("Generating schema: " + name) bi.write_to_file("water/bindings/pojos/%s.java" % name, generate_schema(name, schema)) for name, values in bi.enums().items(): bi.vprint("Generating enum: " + name) bi.write_to_file("water/bindings/pojos/%s.java" % name, generate_enum(name, sorted(values))) for name, endpoints in bi.endpoint_groups().items(): bi.vprint("Generating proxy: " + name) bi.write_to_file("water/bindings/proxies/retrofit/%s.java" % name, generate_proxy(name, endpoints)) bi.vprint("Generating H2oApi.java") bi.write_to_file("water/bindings/H2oApi.java", generate_main_class(bi.endpoints())) type_adapter.vprint_translation_map()
def main(): bi.init("Python", "../../../h2o-py/h2o/estimators", clear_dir=False) modules = [("deeplearning", "H2OAutoEncoderEstimator", "Unsupervised"), ("estimator_base", "H2OEstimator", "Miscellaneous"), ("grid_search", "H2OGridSearch", "Miscellaneous"), ("automl", "H2OAutoML", "Miscellaneous")] builders = filter(lambda b: b[0] != 'coxph', bi.model_builders().items()) # CoxPH is not supported in Python yet for name, mb in builders: module = name if name == "drf": module = "random_forest" if name == "naivebayes": module = "naive_bayes" bi.vprint("Generating model: " + name) bi.write_to_file("%s.py" % module, gen_module(mb, name)) category = "Supervised" if mb["supervised"] else "Unsupervised" if name in {"svd", "word2vec"}: category = "Miscellaneous" modules.append((module, algo_to_classname(name), category)) bi.write_to_file("__init__.py", gen_init(modules)) bi.write_to_file("../../docs/modeling.rst", gen_models_docs(modules)) type_adapter1.vprint_translation_map()
def main(): bi.init("Python", "../../../h2o-py/h2o/estimators", clear_dir=False) modules = [("deeplearning", "H2OAutoEncoderEstimator", "Unsupervised"), ("estimator_base", "H2OEstimator", "Miscellaneous"), ("grid_search", "H2OGridSearch", "Miscellaneous"), ("automl", "H2OAutoML", "Miscellaneous")] builders = bi.model_builders().items() for name, mb in builders: module = name if name == "drf": module = "random_forest" if name == "naivebayes": module = "naive_bayes" if name == "isolationforest": module = "isolation_forest" bi.vprint("Generating model: " + name) bi.write_to_file("%s.py" % module, gen_module(mb, name)) category = "Supervised" if mb["supervised"] else "Unsupervised" if name in {"svd", "word2vec"}: category = "Miscellaneous" modules.append((module, algo_to_classname(name), category)) bi.write_to_file("__init__.py", gen_init(modules)) bi.write_to_file("../../docs/modeling.rst", gen_models_docs(modules)) type_adapter1.vprint_translation_map()
#!/usr/bin/env python # -*- encoding: utf-8 -*- from __future__ import unicode_literals import json import bindings as bi if __name__ == "__main__": bi.init("Docs Json", "../../../h2o-docs", clear_dir=False) bi.vprint("Writing schemas.json...") bi.write_to_file("schemas.json", json.dumps(bi.schemas(raw=True))) bi.vprint("Writing routes.json...") bi.write_to_file("routes.json", json.dumps(bi.endpoints(raw=True)))
yield " * This file is auto-generated by h2o-3/h2o-bindings/bin/gen_csharp.py" yield " * Copyright 2016 H2O.ai; Apache License Version 2.0 (see LICENSE for details)" yield " */" yield "namespace ai.h2o" yield "{" yield " public enum " + name + " {" for value in values: yield " %s," % value yield " }" yield "}" # ---------------------------------------------------------------------------------------------------------------------- # MAIN: # ---------------------------------------------------------------------------------------------------------------------- if __name__ == "__main__": bi.init("C#", "CSharp") type_adapter = CSharpTypeTranslator() for schema in bi.schemas(): name = schema["name"] bi.vprint("Generating schema: " + name) bi.write_to_file("h2o/%s.cs" % name, generate_schema(name, schema)) for name, values in bi.enums().items(): bi.vprint("Generating enum: " + name) bi.write_to_file("h2o/%s.cs" % name, generate_enum(name, sorted(values))) type_adapter.vprint_translation_map()
yield "/**" yield " * This file is auto-generated by h2o-3/h2o-bindings/bin/gen_csharp.py" yield " * Copyright 2016 H2O.ai; Apache License Version 2.0 (see LICENSE for details)" yield " */" yield "namespace ai.h2o" yield "{" yield " public enum " + name + " {" for value in values: yield " %s," % value yield " }" yield "}" # ---------------------------------------------------------------------------------------------------------------------- # MAIN: # ---------------------------------------------------------------------------------------------------------------------- if __name__ == "__main__": bi.init("C#", "CSharp") type_adapter = CSharpTypeTranslator() for schema in bi.schemas(): name = schema["name"] bi.vprint("Generating schema: " + name) bi.write_to_file("h2o/%s.cs" % name, generate_schema(name, schema)) for name, values in bi.enums().items(): bi.vprint("Generating enum: " + name) bi.write_to_file("h2o/%s.cs" % name, generate_enum(name, sorted(values))) type_adapter.vprint_translation_map()
name = field["name"] if name in thrift_reserved_words: name += "_" required = "required" if field["required"] else "optional" yield bi.wrap(field["help"], indent=" # ") yield " {num}: {req} {type} {name},".format(num=i, req=required, type=thrift_type, name=name) yield "" yield "}" yield "" # ---------------------------------------------------------------------------------------------------------------------- # MAIN # ---------------------------------------------------------------------------------------------------------------------- if __name__ == "__main__": bi.init("Thrift", "thrift") type_adapter = ThriftTypeTranslator() schemas_map = bi.schemas_map() ordered_schemas = OrderedDict() for name, schema in schemas_map.items(): add_schema_to_dependency_array(schema, ordered_schemas, schemas_map) bi.write_to_file("water/bindings/structs/H2O.thrift", generate_thrift(ordered_schemas)) type_adapter.vprint_translation_map()
for i, field in enumerate(schema["fields"]): if field["name"] == "__meta": continue thrift_type = translate_type(field["type"], field["schema_name"]) name = field["name"] if name in thrift_reserved_words: name += "_" required = "required" if field["required"] else "optional" yield bi.wrap(field["help"], indent=" # ") yield " {num}: {req} {type} {name},".format(num=i, req=required, type=thrift_type, name=name) yield "" yield "}" yield "" # ---------------------------------------------------------------------------------------------------------------------- # MAIN # ---------------------------------------------------------------------------------------------------------------------- if __name__ == "__main__": bi.init("Thrift", "thrift") type_adapter = ThriftTypeTranslator() schemas_map = bi.schemas_map() ordered_schemas = OrderedDict() for name, schema in schemas_map.items(): add_schema_to_dependency_array(schema, ordered_schemas, schemas_map) bi.write_to_file("water/bindings/structs/H2O.thrift", generate_thrift(ordered_schemas)) type_adapter.vprint_translation_map()