We have h2o cluster on linux machine (ran through command line), and we are connecting it from our local machine (Windows) which is on the same network.
When we try to call saveModel we are getting errors.
ERROR: Unexpected HTTP Status code: 412 Precondition Failed (url = http://10.0.0.4:54321/99/Models.bin/)
//Code to load model from local machine,IDE- Rstudio
ModelName <- "GLM_model_R_1522217891094_1279"
modelpath <-file.path("file://dsvm-dev/Models",ModelName)
Model.h2o <- h2o.loadModel(modelpath)
//to save model
h2o.saveModel(object = best_model,path = "file://dsvm-dev/Models2/",force = TRUE)
Please suggest any alternate ways to save model to local machine(Windows) instead of on server. Also while saving it on server it saves to library folder, because we do not have access to machine.
Related
I am using the H2O R package.
My understanding is, that this package requires you to have an internet connection as well as connect to the the h2o servers? If you use the h2o package run machine learning models on your data, does h2o "see" your data? I turned off my wifi and tried running some machine learning models using h2o :
data(iris)
library(h2o)
h2o.init()
iris_hf <- as.h2o(iris)
iris_dl <- h2o.deeplearning(x = 1:4, y = 5, training_frame = iris_hf, seed=123456)
predictions <- h2o.predict(iris_dl, iris_hf)
This seems to work, but could someone please confirm? If you do not want anyone to see your data, is it still a good idea to use the "h2o" library? Since the code above runs without an internet connection, I am not sure about this.
From the documentation of h2o.init() (emphasis mine):
This method first checks if H2O is connectible. If it cannot connect and startH2O = TRUE with IP of localhost, it will attempt to start an instance of H2O with IP = localhost, port = 54321. Otherwise, it stops immediately with an error. When initializing H2O locally, this method searches for h2o.jar in the R library resources [...], and if the file does not exist, it will automatically attempt to download the correct version from Amazon S3. The user must have Internet access for this process to be successful. Once connected, the method checks to see if the local H2O R package version matches the version of H2O running on the server. If there is a mismatch and the user indicates she wishes to upgrade, it will remove the local H2O R package and download/install the H2O R package from the server.
So, h2o.init() with the default setting ip = "127.0.0.1", as here, connects the R session with the H2O instance (sometimes referred to as "server") in your local machine. If all the necessary package files are in place and up to date, no internet connection is necessary; the package will attempt to connect to the internet only to download stuff in case something is not present or up to date. No data is uploaded anywhere.
I have a MLFlow remote server and I am able to log things from rstudio like:
mlflow_log_param("param1", 5)
mlflow_log_param("param2", 5)
mlflow_log_metric("foo", 1)
mlflow_log_metric("foo", 2)
mlflow_log_metric("foo", 3)
But when I try to log things like:
writeLines("Hello world!", "output.txt")
mlflow_log_artifact("output.txt")
I have this error:
2020/04/01 21:45:27 INFO mlflow.store.artifact.cli: Logged artifact from local file output.txt to artifact_path=None
Root URI: ./mlruns/12/3256cfd3cd1b44b99334040bd5c7c9ee/artifacts
And when I try to log a model:
mlflow_log_model(predictor, "model1")
I have next error:
2020/04/01 21:56:44 INFO mlflow.store.artifact.cli: Logged artifact from local dir D:/user/AppData/Local/Temp/RtmpcBwDOP/model1 to artifact_path=model1
Root URI: ./mlruns/12/07d84e0f252a4248bb2473229297d318/artifacts
# A tibble: 0 x 0
Warning message:
In value[[3L]](cond) :
Logging model metadata to the tracking server has failed, possibly due to older server version. The model artifacts have been logged successfully. In addition to exporting model artifacts, MLflow clients 1.7.0 and above attempt to record model metadata to the tracking store. If logging to a mlflow server via REST, consider upgrading the server version to MLflow 1.7.0 or above.
The server is updated and also the client.
I'm using Azure Machine Learning Service with the azureml-sdk python library.
I'm using azureml.core version 1.0.8
I'm following this https://learn.microsoft.com/en-us/azure/machine-learning/service/how-to-create-your-first-pipeline tutorial.
I've got it working when I use Azure Compute resources. But I would like to run it locally.
I get the following error
raise ErrorResponseException(self._deserialize, response)
azureml.pipeline.core._restclients.aeva.models.error_response.ErrorResponseException: (BadRequest) Response status code does not indicate success: 400 (Bad Request).
Trace id: [uuid], message: Can't build command text for [train.py], moduleId [uuid] executionId [id]: Assignment for parameter Target is not specified
My code looks like:
run_config = RunConfiguration()
compute_target = LocalTarget()
run_config.target = LocalTarget()
run_config.environment.python.conda_dependencies = CondaDependencies(conda_dependencies_file_path='environment.yml')
run_config.environment.python.interpreter_path = 'C:/Projects/aml_test/.conda/envs/aml_test_env/python.exe'
run_config.environment.python.user_managed_dependencies = True
run_config.environment.docker.enabled = False
trainStep = PythonScriptStep(
script_name="train.py",
compute_target=compute_target,
source_directory='.',
allow_reuse=False,
runconfig=run_config
)
steps = [trainStep]
# Build the pipeline
pipeline = Pipeline(workspace=ws, steps=[steps])
pipeline.validate()
experiment = Experiment(ws, 'Test')
# Fails, locally, works on Azure Compute
run = experiment.submit(pipeline)
# Works both locally and on Azure Compute
src = ScriptRunConfig(source_directory='.', script='train.py', run_config=run_config)
run = experiment.submit(src)
The train.py is a very simple self contained script only dependent on numpy that approximates pi.
Local compute cannot be used with ML Pipelines. Please see this article.
Training on you local machine (for instance during development) is possible and very easy according to the documentation: how-to-set-up-training-targets
I did this on my windows computer as follows:
Define the local environment:
sklearn_env = Environment("user-managed-env")
sklearn_env.python.user_managed_dependencies = True
# You can choose a specific Python environment by pointing to a Python path
sklearn_env.python.interpreter_path = r'C:\Dev\tutorial\venv\Scripts\python.exe'
And compute_target='local' seems to be the magic word to direct a script to my local environment.
src = ScriptRunConfig(source_directory=script_folder,
script='train_iris.py',
arguments=[dataset.as_named_input('iris')],
compute_target='local',
environment=sklearn_env)
I will then need to make sure that my local environment has all the dependencies that the script needs.
Additionally I needed to install these packages on my local machine:
azureml-defaults
packaging
I'd like to able manage table on SQL Server via my R script and RevoScaleR library.
I have Machine Learning Services installed on a local instance and Microsoft R Client as an interpreter for R. I can get a connection to the server.
However, it seems, I can't create a table on the server.
I've tried:
> predictionSql = RxSqlServerData(table = "PredictionLinReg", connectionString = connStr)
> predict_linReg = rxPredict(LinReg_model, input_data, outData = predictionSql, writeModelVars=TRUE)
...which returns:
Error in rxCompleteClusterJob(hpcServerJob, consoleOutput,
autoCleanup) : No results available - final job state: failed
Help would be appreciated. New to R.
I am trying to follow the "Getting started with MongoDB in R" page to get a database up and running. I have mongoDB installed in my PATH so I am able to run mongod from the terminal and open an instance. Though when I open an instance in the background and try running the following commands in R:
library(mongolite)
m <- mongo(collection = "diamonds") #diamonds is a built in dataset
It throws an error after that last statement saying:
Error: No suitable servers found (`serverSelectionTryOnce` set): [Failed to resolve 'localhost']
How do I enable it to find the connection I have open? Or is it something else? Thanks.
It could be that mongolite is looking in the wrong place for the local server. I solved this same problem for myself by explicitly adding the local host address in the connection call:
m <- mongo(collection = "diamonds", url = "mongodb://127.0.0.1")