{"id":27431000,"url":"https://github.com/bigmlcom/bigml-objc","last_synced_at":"2025-06-26T00:05:36.764Z","repository":{"id":140668696,"uuid":"50049924","full_name":"bigmlcom/bigml-objc","owner":"bigmlcom","description":"BigML REST API Bindings for Objective-C","archived":false,"fork":false,"pushed_at":"2017-08-01T15:38:58.000Z","size":536,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-14T15:51:26.722Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bigmlcom.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2016-01-20T18:13:46.000Z","updated_at":"2018-10-24T15:20:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"7dc04000-a2bf-4fe0-bbe9-71425c8900cf","html_url":"https://github.com/bigmlcom/bigml-objc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bigmlcom/bigml-objc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmlcom%2Fbigml-objc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmlcom%2Fbigml-objc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmlcom%2Fbigml-objc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmlcom%2Fbigml-objc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bigmlcom","download_url":"https://codeload.github.com/bigmlcom/bigml-objc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bigmlcom%2Fbigml-objc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261973726,"owners_count":23238586,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-14T15:28:16.817Z","updated_at":"2025-06-26T00:05:36.733Z","avatar_url":"https://github.com/bigmlcom.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"BigML Objective C Bindings\n=====================\n\nIn this repository you'll find an open source @(language) client that\ngives you a simple binding to interact with `BigML\n\u003chttps://bigml.com\u003e`.\n\nBigML makes machine learning easy by taking care of the details\nrequired to add data-driven decisions and predictive power to your\ncompany. Unlike other machine learning services, BigML creates\n`beautiful predictive models \u003chttps://bigml.com/gallery/models\u003e`_ that\ncan be easily understood and interacted with.\n\nThe BigML @(language) bindings allow you to interact with `BigML.io\n\u003chttps://bigml.io/\u003e`, the API for BigML. You can use it to easily\ncreate, retrieve, list, update, and delete BigML resources (i.e.,\nsources, datasets, models and, predictions, and `many more\n\u003chttps://bigml.com/developers/\u003e`). Additionally, they also provide a\nfew ML algorithms that can be run locally, i.e. offline, such as to\nmake a prediction from a model, calculate an anomaly score, etc.\n\nThis module is licensed under the `Apache License, Version\n2.0 \u003chttp://www.apache.org/licenses/LICENSE-2.0.html\u003e`.\n\n\nSupport\n-------\n\nPlease report problems and bugs to our `BigML.io issue\ntracker \u003chttps://github.com/bigmlcom/io/issues\u003e`.\n\nDiscussions about the different bindings take place in the general\n`BigML mailing list \u003chttp://groups.google.com/group/bigml\u003e`. Or join us\nin our `Campfire chatroom \u003chttps://bigmlinc.campfirenow.com/f20a0\u003e`.\n\nRequirements\n------------\n\n`bigml-objec` is compatible with Modern Objective C and requires ARC.\n\n\nImporting the module\n--------------------\n\nThe easiest way to use the BigML Objective-C SDK is to drag the\n`bigml-objc` folder on to your Xcode project. Alternatively, you can\ndrag the Xcode project bigml-objc.xcodeproj on to your Xcode project,\nthen set your project settings so it handles properly the header\nand library path.\n\nWhen you need to call a method from `bigml-objc` inside a file of\nyours, put the following directive on top of it:\n\n    #import \"bigml-objc.h\"\n\nIf you included bigml-objc.xcodeproj as a subproject of your Xcode\nproject, the above import directly will only work if you have\npreviously set the project settings to correctly handle the header\npath.\n\n\nAuthentication\n--------------\n\nAll the requests to BigML.io must be authenticated using your username\nand `API key \u003chttps://bigml.com/account/apikey\u003e` and are always\ntransmitted over HTTPS.\n\nKnowing that, connecting to BigML is a breeze. You just need to\nexecute:\n\n\n    BMLAPIConnector* api = [BMLAPIConnector connectorWithUsername:@\"username\"\n                                                           apiKey:@\"api-key\"\n                                                             mode:BMLModeProduction];\n\n\nAlternatively, you can initialize the library to work in BigML's Sandbox\nenvironment, which is meant for you to experiment free of charge:\n\n\n    BMLAPIConnector* api = [BMLAPIConnector connectorWithUsername:@\"username\"\n                                                           apiKey:@\"api-key\"\n                                                             mode:BMLModeDevelopment];\n\n\n\nQuick Start\n-----------\n\nImagine that you want to use `this csv\nfile \u003chttps://static.bigml.com/csv/iris.csv\u003e` containing the `Iris\nflower dataset \u003chttp://en.wikipedia.org/wiki/Iris_flower_data_set\u003e`_ to\npredict the species of a flower whose ``sepal length`` is ``5`` and\nwhose ``sepal width`` is ``2.5``. A preview of the dataset is shown\nbelow. It has 4 numeric fields: ``sepal length``, ``sepal width``,\n``petal length``, ``petal width`` and a categorical field: ``species``.\nBy default, BigML considers the last field in the dataset as the\nobjective field (i.e., the field that you want to generate predictions\nfor).\n\n\n    sepal length,sepal width,petal length,petal width,species\n    5.1,3.5,1.4,0.2,Iris-setosa\n    4.9,3.0,1.4,0.2,Iris-setosa\n    4.7,3.2,1.3,0.2,Iris-setosa\n    ...\n    5.8,2.7,3.9,1.2,Iris-versicolor\n    6.0,2.7,5.1,1.6,Iris-versicolor\n    5.4,3.0,4.5,1.5,Iris-versicolor\n    ...\n    6.8,3.0,5.5,2.1,Iris-virginica\n    5.7,2.5,5.0,2.0,Iris-virginica\n    5.8,2.8,5.1,2.4,Iris-virginica\n\nYou can easily generate a prediction following these steps::\n\n\n    BMLAPIConnector* api = [BMLAPIConnector connectorWithUsername:@\"username\"\n                                                           apiKey:@\"api-key\"\n                                                             mode:BMLModeDevelopment];\n\n    BMLMinimalResource* resource =\n    [[BMLMinimalResource alloc] initWithName:@\"My Data Source\"\n                                        type:BMLResourceTypeFile\n                                        uuid:@\"./tests/data/iris.csv\"\n                                  definition:nil];\n\n    // All requests are asynchronous and have a completion block\n    [_api createResource:BMLResourceTypeSource\n                          name:file\n                       options:nil\n                          from:resource\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n\n                           if (error == nil) {\n\n                              [_api createResource:BMLResourceTypeDataset\n                                              name:file\n                                           options:nil\n                                              from:resource\n                                        completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n\n                                              if (error == nil) {\n                                                  [_api createResource:BMLResourceTypeModel\n                                                                  name:file\n                                                               options:nil\n                                                                  from:resource\n                                                            completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                                                                if (error == nil) {\n                                                                    NSDictionary* pred = [BMLLocalPredictions\n                                                                       localPredictionWithJSONModelSync:resource.jsonDefinition\n                                                                                              arguments:@{@\"sepal width\" : @3.15,\n                                                                                       @\"petal length\" : @4.07,\n                                                                                        @\"petal width\" : @1.51}\n                                                                                   options:@{@\"byName\" : @YES}];\n                                                                       NSLog(@\"First\n                                                  Prediction: %@\", pred);\n\n                                                                }\n                                        }];\n                                    }\n                               }];\n                           }\n                    }];\n\n\n\nDataset\n-------\n\nIf you want to get some basic statistics for each field you can\nretrieve the fields from the dataset as follows to get a dictionary\nkeyed by field id:\n\n\n    [_api getResource:BMLResourceTypeDataset\n                    uuid:datasetUuid\n              completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                  if (error == nil) {\n                      NSLog(@\"Fields: %@\", resource.jsonDefinition[@\"fields\"]);\n                  }\n    }];\n\n\n\nThe field filtering options are also available using a query string\nexpression, for instance:\n\n\n    [_api listResource:BMLResourceTypeDataset\n                    filters:@{@\"limit\" : @5}\n              completion:^(NSArray* resources, NSError* error) {\n                  //-- process resources or handle error\n              }];\n\n\n\nlimits the number of fields that will be included in dataset to 20.\n\nModel\n-----\n\nOne of the greatest things about BigML is that the models that it\ngenerates for you are fully white-boxed.  To get the explicit\ntree-like predictive model for the example above:\n\n\n    [_api getResource:BMLResourceTypeModel\n                 uuid:modelUuid\n           completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                  //-- process resource or handle error\n              }];\n\n\n\nAgain, filtering options are also available using a query string\nexpression, for instance:\n\n\n    [_api listResource:BMLResourceTypeModel\n                    filters:@{@\"limit\" : @5}\n              completion:^(NSArray* resources, NSError* error) {\n                  //-- process resources or handle error\n              }];\n\n\n\nlimits the number of fields that will be included in model to 5.\n\nProjects\n---------\n\nA special kind of resource is ``project``. Projects are repositories\nfor resources, intended to fulfill organizational purposes. Each project can\ncontain any other kind of resource, but the project that a certain resource\nbelongs to is determined by the one used in the ``source``\nthey are generated from. Thus, when a source is created\nand assigned a certain ``project_id``, the rest of resources generated from\nthis source will remain in this project.\n\nThe REST calls to manage the ``project`` resemble the ones used to manage the\nrest of resources. When you create a ``project``:\n\n\n[_api createResource:BMLResourceTypeProject\n                name:@\"my first project\"\n             options:nil\n          completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n        //-- process resource\n}];\n\n\n\nthe resulting resource is similar to the rest of resources, although shorter::\n\n    {'code': 201,\n     'resource': 'project/54a1bd0958a27e3c4c0002f0',\n     'location': 'http://bigml.io/andromeda/project/54a1bd0958a27e3c4c0002f0',\n     'object': {'category': 0,\n                'updated': '2014-12-29T20:43:53.060045',\n                'resource': 'project/54a1bd0958a27e3c4c0002f0',\n                'name': 'my first project',\n                'created': '2014-12-29T20:43:53.060013',\n                'tags': [],\n                'private': True,\n                'dev': None,\n                'description': ''},\n     'error': None}\n\nand you can use its project id to get, update or delete it:\n\n\n**Important**: Deleting a non-empty project will also delete **all resources**\nassigned to it, so please be extra-careful when doing it.\n\nCreating sources\n----------------\n\nTo create a source from a local data file, you can use the create_source method. The only required parameter is the path to the data file (or file-like object). You can use a second optional parameter to specify any of the options for source creation described in the `BigML API documentation \u003chttps://bigml.com/developers\u003e`.\n\nHere’s a sample invocation::\n\n\n    BMLMinimalResource* resource =\n    [[BMLMinimalResource alloc] initWithName:@\"My Data Source\"\n                                        type:BMLResourceTypeFile\n                                        uuid:@\"./tests/data/iris.csv\"\n                                  definition:nil];\n\n    [_api createResource:BMLResourceTypeSource\n                          name:@\"TestCreateDatasource\"\n                       options:@{@\"source_parser\" : @{ @\"header\" : @NO, @\"missing_tokens\" : @[@\"x\"]}}\n                          from:resource\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                        //-- process resource or handle error\n                    }];\n\n\n\nor you may want to create a source from a file in a remote location::\n\n\n    [_api createResource:BMLResourceTypeSource\n                          name:@\"TestCreateDatasourceFromRemoteFile\"\n                       options:@{@\"remote\" : @\"s3://bigml-public/csv/iris.csv\"}\n                          from:resource\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                        //-- process resource or handle error\n                    }];\n\n\n\nCreating datasets\n-----------------\n\nOnce you have created a source, you can create a dataset. The only\nrequired argument to create a dataset is a source id.  You can add any\nof the optional arguments accepted by BigML and documented in `the\nDatasets section of the Developer’s documentation\n\u003chttps://bigml.com/developers/datasets\u003e`.\n\nFor example, to create a dataset named “my dataset” with the first\n1024 bytes of a source, you can execute the following call:\n\n\n    [_api createResource:BMLResourceTypeDataset\n                          name:@\"TestCreateDatasetWithOptions\"\n                       options:@{@\"size\" : @1024}\n                          from:source\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                        //-- process resource or handle error\n                    }];\n\n\n\nYou can also extract samples from an existing dataset and generate a\nnew one with them with the following call:\n\n\n    [_api createResource:BMLResourceTypeDataset\n                          name:@\"TestCloneDatasetWithSampling\"\n                       options:@{@\"sample_rate\" : @0.8}\n                          from:originDataset\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                        //-- process resource or handle error\n                    }];\n\n\n\n\nCreating models\n---------------\n\nOnce you have created a dataset you can create a model from it.  If\nyou don’t select one, the model will use the last field of the dataset\nas objective field.  The only required argument to create a model is a\ndataset id.  You can also include in the request all the additional\narguments accepted by BigML and documented in `the Models section of\nthe Developer’s documentation \u003chttps://bigml.com/developers/models\u003e`.\n\nFor example, to create a model only including the first two fields and the first 10 instances in the dataset, you can use the following invocation::\n\n\n    [_api createResource:BMLResourceTypeModel\n                          name:@\"TestCreateModel\"\n                       options:@{@\"name\" : @\"My Model\",\n                         @\"input_fields\" : @[@\"000000\", @\"000001\"],\n                                @\"range\" : @[1, 10]}\n                          from:dataset\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                        //-- process resource or handle error\n                    }];\n\n\n\nthe model is scheduled for creation.\n\nCreating clusters\n-----------------\n\nIf your dataset has no fields showing the objective information to\npredict for the training data, you can still build a cluster that will\ngroup similar data around some automatically chosen points\n(centroids).  Again, the only required argument to create a cluster is\nthe dataset id.  You can also include in the request all the\nadditional arguments accepted by BigML and documented in `the Clusters\nsection of the Developer’s documentation\n\u003chttps://bigml.com/developers/clusters\u003e`.\n\nLet’s create a cluster from a given dataset:\n\n\n    [_api createResource:BMLResourceTypeCluster\n                          name:@\"TestCreateCluster\"\n                       options:@{@\"k\" : @5}\n                          from:dataset\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                        //-- process resource or handle error\n                    }];\n\n\n\nthat will create a cluster with 5 centroids.\n\nCreating anomaly detectors\n--------------------------\n\nIf your problem is finding the anomalous data in your dataset, you can\nbuild an anomaly detector, that will use iforest to single out the\nanomalous records. Again, the only required argument to create an\nanomaly detector is the dataset id. You can also include in the\nrequest all the additional arguments accepted by BigML and documented\nin the `Anomaly detectors section of the Developer’s documentation\n\u003chttps://bigml.com/developers/anomalies\u003e`_.\n\nLet’s create an anomaly detector from a given dataset:\n\n\n    [_api createResource:BMLResourceTypeAnomaly\n                          name:@\"TestCreateAnomaly\"\n                       options:nil\n                          from:dataset\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                        //-- process resource or handle error\n                    }];\n\n\n\nCreating associations\n---------------------\n\nTo find relations between the field values you can create an association\ndiscovery resource. The only required argument to create an association\nis a dataset id.\nYou can also\ninclude in the request all the additional arguments accepted by BigML\nand documented in the `Association section of the Developer's\ndocumentation \u003chttps://bigml.com/developers/associations\u003e`_.\n\nFor example, to create an association only including the first two fields and\nthe first 10 instances in the dataset, you can use the following\ninvocation:\n\n\n    [_api createResource:BMLResourceTypeAssociation\n                          name:@\"TestCreateAssociation\"\n                       options:@{@\"name\" : @\"My Association\",\n                         @\"input_fields\" : @[@\"000000\", @\"000001\"],\n                                @\"range\" : @[1, 10]}\n                          from:dataset\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                        //-- process resource or handle error\n                    }];\n\n\n\nAssociations can also be created from lists of datasets. Just use the\nlist of ids as the first argument in the api call:\n\n\n    [_api createResource:BMLResourceTypeAssociation\n                          name:@\"TestCreateAssociation\"\n                       options:@{@\"name\" : @\"My Association\",\n                         @\"input_fields\" : @[@\"000000\", @\"000001\"],\n                                @\"range\" : @[1, 10]}\n                          from:dataset\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                        //-- process resource or handle error\n                    }];\n\n\n\nCreating predictions\n--------------------\n\nYou can now use the model resource identifier together with some input parameters to ask for predictions, using the create_prediction method.\nYou can also give the prediction a name:\n\n\n    [_api createResource:BMLResourceTypePrediction\n                          name:@\"TestCreateRemotePrediction\"\n                       options:@{@\"name\" : @\"My Prediction\",\n                         @\"input_data\" : @{@\"sepal length\" : @5, @\"sepal width\" : @2.5}}\n                          from:dataset\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                        //-- process resource or handle error\n                    }];\n\n\n\nCreating centroids\n------------------\n\nTo obtain the centroid associated to new input data, you can now use\nthe create_centroid method.  Give the method a cluster identifier and\nthe input data to obtain the centroid.  You can also give the centroid\npredicition a name:\n\n\n    [_api createResource:BMLResourceTypeCentroid\n                          name:@\"TestCreateRemoteCentroid\"\n                       options:@{@\"name\" : @\"My Centroid\",\n                         @\"input_data\" : @{@\"pregnancies\" : @0,\n                                            @\"plasma glucose\" : @118,\n                                            @\"blood pressure\" : @84,\n                                            @\"triceps skin thickness\" : @47,\n                                            @\"insulin\" : @230,\n                                            @\"bmi\" : @45.8,\n                                            @\"diabetes pedigree\" : @0.551,\n                                            @\"age\" : @31,\n                                            @\"diabetes\" : @YES}}\n                          from:dataset\n                    completion:^(id\u003cBMLResource\u003e resource, NSError* error) {\n                        //-- process resource or handle error\n                    }];\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmlcom%2Fbigml-objc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbigmlcom%2Fbigml-objc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbigmlcom%2Fbigml-objc/lists"}