Commit c835696f authored by vimazeno's avatar vimazeno
Browse files

Merge branch 'tids' into 'master'

Tids

See merge request !5
parents 0c1f5e38 7557c7d0
......@@ -20,4 +20,10 @@ CONSTRAINT_MINING_DISTANT_IDLE_TIMEOUT=60
CONSTRAINT_MINING_CONSECUTIVE_PATH=bin/sourceCode.R
CONSTRAINT_MINING_CONSECUTIVE_TIMEOUT=60
CONSTRAINT_MINING_CONSECUTIVE_IDLE_TIMEOUT=60
\ No newline at end of file
CONSTRAINT_MINING_CONSECUTIVE_IDLE_TIMEOUT=60
CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_PATH=bin
CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_CMD="/usr/bin/Rscript"
CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_R_SCRIPT="source_code_graduel_avec_tid.R"
CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_TIMEOUT=60
CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_IDLE_TIMEOUT=60
\ No newline at end of file
......@@ -18,4 +18,10 @@ CONSTRAINT_MINING_DISTANT_IDLE_TIMEOUT=60
CONSTRAINT_MINING_CONSECUTIVE_PATH=bin/sourceCode.R
CONSTRAINT_MINING_CONSECUTIVE_TIMEOUT=60
CONSTRAINT_MINING_CONSECUTIVE_IDLE_TIMEOUT=60
\ No newline at end of file
CONSTRAINT_MINING_CONSECUTIVE_IDLE_TIMEOUT=60
CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_PATH=bin
CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_CMD="/usr/bin/Rscript"
CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_R_SCRIPT="source_code_graduel_avec_tid.R"
CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_TIMEOUT=60
CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_IDLE_TIMEOUT=60
\ No newline at end of file
......@@ -27,4 +27,7 @@ yarn-error.log
/bin/FileForAprioriTID.txt
/admin/node_modules/
/mercure/updates.db
/public/uploads/
\ No newline at end of file
/public/uploads/
.vscode
FileForAprioriTID.txt
**/FileForAprioriTID.txt
\ No newline at end of file
- [ ] redirigier login si connecté
sudo apt install default-jre
sudo apt install default-jdk
sudo Rscript -e 'install.packages("https://cran.r-project.org/src/contrib/Archive/arules/arules_1.6-5.tar.gz")'
bin/sourceCode.R
0.2 \
1 \
/data/dev/projets/mobipaleo/datasheets/exampleDataSet-with-espace.data \
/data/dev/projets/mobipaleo/public/uploads/datasheets/consecutive-example1-input.out.csv
sudo Rscript -e 'install.packages("rJava")'
cd bin
Rscript sourceCode2.R \
/data/dev/projets/mobipaleo/datasheets/exampleDataSet-with-espace.data \
0.2 \
/data/dev/projets/mobipaleo/public/uploads/datasheets/consecutive-example1-input.out2.csv
Rscript bin/sourceCode2.R \
/data/dev/projets/mobipaleo/datasheets/test3.data \
0.2 \
/data/dev/projets/mobipaleo/public/uploads/datasheets/consecutive-example1-input.out2.csv
php bin/console app:mining consecutive 20 consecutive-example1-input.csv
php bin/console app:mining distant 20 consecutive-example2-input.csv
\ No newline at end of file
......@@ -104,6 +104,7 @@ $(document).ready(function() {
// disable reload page on submit new job
// prepend returned job template
$("#job-form").on('submit', function(e) {
e.preventDefault();
var formData = new FormData($(this)[0]);
var XHR = false;
var XHRResponse = false;
......@@ -111,31 +112,29 @@ $(document).ready(function() {
// https://stackoverflow.com/questions/20795449/jquery-ajax-form-submission-enctype-multipart-form-data-why-does-contentt
formData.append('spreadsheet', $('#job_datasheet')[0].files[0]);
$.ajax({
url: '/',
url: '/job',
data: formData,
cache: false,
contentType: false,
processData: false,
method: $(this).attr('method'),
async: false,
async: true,
type: $(this).attr('method'), // For jQuery < 1.9
global: false,
dataType: 'html',
success: function(data)
{
XHRResponse = data;
var matcher = new RegExp("<html>", "g");
if(matcher.test(XHRResponse)) {
XHR = true;
} else {
$('#job_list').prepend(XHRResponse);
XHR = false;
}
return XHR;
}
});
var matcher = new RegExp("<html>", "g");
if(matcher.test(XHRResponse)) {
XHR = true;
} else {
$('#job_list').prepend(XHRResponse);
XHR = false;
}
return XHR;
//e.preventDefault();
});
// force path rendering in input file
......
## inputs parameters
argv <- commandArgs(TRUE)
# -- The minimum support --
#minSup <- as.double(argv[1])
minSup <- as.double(argv[2])
# -- The minimum length of extracted gradual pattern
#minLength <- as.integer(argv[2])
minLength <- as.integer(1)
# -- Input file
#input <- argv[3]
input <- argv[1]
# -- Output file
output <- argv[3]
# -- Define output tempon file & input Convolution
outputInputTemp <- "FileForAprioriTID.txt"
# -- The Firts constant
#k1 <- as.numeric(argv[5])
k1 <- 0
# -- The Second constant
#k2 <- as.numeric(argv[6])
k2 <- 0
cat("\n")
cat("----- The minimum support is ", minSup, "------ \n")
cat("\n")
cat("----- The minimum length of extracted gradual pattern is ", minLength, "----\n")
cat("\n")
cat("----- The Firts constant is", k1, "----\n")
cat("\n")
cat("----- The second constant is ", k2, "----\n")
cat("\n")
#cat("----- The separator of data is ", argv[7], "------ \n")
#cat("----- The separator of data is ", argv[3], "------ \n")
cat("----- The separator of data is ", " ", "------ \n")
cat("\n")
## import library Java
library("rJava")
## Read input data file
#data <- read.csv(input, sep = argv[7])
#data <- read.csv(input, sep = argv[3])
data <- read.csv(input, sep = " ")
## ------ The beginning of the standard deviation ------
## Transform dataframe to matrix
data_mat <- as.matrix(data)
## ------ Time ------
t1 <- Sys.time()
## ------ Debut standard deviation (sd) ------
ecarttype <- vector("numeric",ncol(data_mat))
for (i in 1 : ncol(data_mat)){
ecarttype[i] <- (sd(data_mat[,i]) * k1) + k2
}
## ------ Fin standard deviation ------
## ------ The beginning of the NumVersCat procedure -------
data_diff <- diff(data_mat)
## -- Util pour APRIORI
tab_vec <- array()
## Transform numerical data matrix to categorical data matrix containing "+", "-" and "o" items
data_cat <- matrix(0, nrow = nrow(data_diff), ncol = ncol(data_diff))
for(i in 1:ncol(data_diff)){
for(j in 1 : nrow(data_diff)){
if ((data_diff[j,i] > ecarttype[i]) & (data_diff[j,i] > 0)){
data_cat[j,i] <-paste0(paste0("X",i),"=+") # Xi=+
}else if((abs(data_diff[j,i]) > ecarttype[i]) & (data_diff[j,i] < 0)){
data_cat[j,i] <-paste0(paste0("X",i),"=-") #Xi=-
}else{
data_cat[j,i] <-paste0(paste0("X",i),"=o") #Xi=o
}
}
}
# ----------------------------------
for (i in 1:nrow(data_cat)) {
for(j in 1:ncol(data_cat)){
if (j == 1) {tab_vec[i] <- data_cat[i,j]}else{tab_vec[i] <- paste(tab_vec[i], data_cat[i,j])}
}
}
# ----------------------------------
# -- Ecrire dans un fichier tempon pour traitement par AprioriTID
write(tab_vec, file = outputInputTemp, sep =" ")
### ----- Dbut Insertion du code java -----
# -- initialisation of the JVM
.jinit()
# -- Add .jar file to the class path
.jaddClassPath("AprioriTID.jar")
# -- instatiation of the Class
obj <- .jnew("AlgoAprioriTID")
cat("----- BEFORE APRIORI ----\n")
# -- Call function directly with parameters
.jcall(obj, "V", "runAlgorithmModifier", outputInputTemp, output, minSup, minLength)
cat("----- AFTER APRIORI ----\n")
t2 <- Sys.time()
t2 - t1
cat("\n")
......@@ -20,6 +20,12 @@ parameters:
constraint_mining_consecutive_timeout: '%env(CONSTRAINT_MINING_CONSECUTIVE_TIMEOUT)%'
constraint_mining_consecutive_idle_timeout: '%env(CONSTRAINT_MINING_CONSECUTIVE_IDLE_TIMEOUT)%'
constraint_mining_consecutive_with_tids_path: '%kernel.project_dir%/%env(CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_PATH)%'
constraint_mining_consecutive_with_tids_cmd: '%env(CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_CMD)%'
constraint_mining_consecutive_with_tids_r_script: '%env(CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_R_SCRIPT)%'
constraint_mining_consecutive_with_tids_timeout: '%env(CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_TIMEOUT)%'
constraint_mining_consecutive_with_tids_idle_timeout: '%env(CONSTRAINT_MINING_CONSECUTIVE_WITH_TIDS_IDLE_TIMEOUT)%'
constraint_mining_distant_path: '%kernel.project_dir%/%env(CONSTRAINT_MINING_DISTANT_PATH)%'
constraint_mining_distant_timeout: '%env(CONSTRAINT_MINING_DISTANT_TIMEOUT)%'
constraint_mining_distant_idle_timeout: '%env(CONSTRAINT_MINING_DISTANT_IDLE_TIMEOUT)%'
......
x1 x2 x3 x4 x5 x6 x7
84 61 7 0 1 8 0
116 36 4 1 11 2 31
90 52 2 3 5 1 13
124 34 1 5 12 7 36
102 49 0 6 7 10 17
135 17 0 1 18 3 62
106 40 3 1 9 0 18
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment