This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
########################################################## | |
# Create & Test a Logistic Regression Model # | |
########################################################## | |
# load mrsdeploy package on R Server | |
library(mrsdeploy) | |
# Use logistic regression equation of vehicle transmission | |
# in the data set mtcars to estimate the probability of | |
# a vehicle being fitted with a manual transmission |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generate Service Consumption Client Library in CSharp from swagger.json | |
install.packages("httr", dependencies = TRUE) | |
library(httr) | |
serviceName <- "ManualTransmissionService" | |
swaggerFileLocation <- "C:/Users/azureuser/Documents/swagger.json" | |
swagger <- readChar(swaggerFileLocation, file.info(swaggerFileLocation)$size) | |
r <- httr::POST("http://generator.swagger.io/api/gen/clients/csharp", | |
add_headers("Content-Type" = "application/json"), | |
body = paste("{\"options\": { \"packageName\" : \"", serviceName, "\" } ,", | |
"\"spec\":", swagger, "}")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Estimate a One-Class SVM model | |
trainRows <- c(1:30, 51:80, 101:130) | |
testRows = !(1:150 %in% trainRows) | |
trainIris <- iris[trainRows,] | |
testIris <- iris[testRows,] | |
trainIris$id <- seq.int(nrow(trainIris)) | |
svmModel <- rxOneClassSvm( | |
formula = ~Sepal.Length + Sepal.Width + Petal.Length + Petal.Width, | |
data = trainIris) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Security.Cryptography.X509Certificates; | |
namespace InstallCert | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(httr) | |
r <- httr::GET("https://<yourstorename>.azuredatalakestore.net/webhdfs/v1/mytempdir/iris.csv?op=OPEN&read=true", | |
add_headers(Authorization = "Bearer <AD AUTH TOKEN>"), | |
write_disk("iris.csv", overwrite=TRUE), progress()) | |
irisData <- rxImport("iris.csv") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Work with HDFS data in local compute context | |
rxHadoopMakeDir("/share/SampleData") | |
rxHadoopCopyFromLocal(file.path(dataPath = rxGetOption("sampleDataDir"), "AirlineDemoSmall.csv"), "/share/SampleData") | |
airDS <- RxTextData(file = "/share/SampleData/AirlineDemoSmall.csv", missingValueString = "M", | |
fileSystem = RxHdfsFileSystem()) | |
rxSetComputeContext("local") | |
adsSummary <- rxSummary(~ArrDelay+CRSDepTime+DayOfWeek, data = airDS) | |
print(adsSummary) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Spark Compute Context | |
sparkCC <- rxSparkConnect() | |
rxHadoopMakeDir("/share/SampleData") | |
rxHadoopCopyFromLocal(file.path(dataPath = rxGetOption("sampleDataDir"), "AirlineDemoSmall.csv"), "/share/SampleData") | |
airDS <- RxTextData(file = "/share/SampleData/AirlineDemoSmall.csv", missingValueString = "M", | |
fileSystem = RxHdfsFileSystem()) | |
adsSummary <- rxSummary(~ArrDelay+CRSDepTime+DayOfWeek, data = airDS) | |
print(adsSummary) | |
rxSparkDisconnect(sparkCC) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Hadoop Compute Context | |
rxSetComputeContext(RxHadoopMR()) | |
rxHadoopMakeDir("/share/SampleData") | |
rxHadoopCopyFromLocal(file.path(dataPath = rxGetOption("sampleDataDir"), "AirlineDemoSmall.csv"), "/share/SampleData") | |
airDS <- RxTextData(file = "/share/SampleData/AirlineDemoSmall.csv", missingValueString = "M", | |
fileSystem = RxHdfsFileSystem()) | |
adsSummary <- rxSummary(~ArrDelay+CRSDepTime+DayOfWeek, data = airDS) | |
print(adsSummary) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Local Compute Context | |
rxSetComputeContext("local") | |
airDS <- RxTextData(file.path(rxGetOption("sampleDataDir"), "AirlineDemoSmall.csv")) | |
adsSummary <- rxSummary(~ArrDelay+CRSDepTime+DayOfWeek, data = airDS) | |
print(adsSummary) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Set Seed | |
set.seed(12345) | |
# AirlineDemoSmall XDF File | |
airline <- RxXdfData(file.path(rxGetOption("sampleDataDir"), "AirlineDemoSmall.xdf")) | |
# Define a split function which splits the dataset into 75% train and 25% test using rxSplit | |
".split" <- function(keys, data) | |
{ | |
dataSplit <- rxSplit(data, |