コード例 #1
0
<?php

$machine = "Prep_HPLC";
$LMCS_rf = $_REQUEST['LMCS_rf'];
$run_time = 0;
$run_time = 0;
$output1 = "";
$percentACN = 0;
if ($machine != "" && $LMCS_rf != "") {
    $output = "";
    $output .= "<b>For the system:</b> <br />";
    //$output .= "<b>Machine :</b> " . $machine . "<br />";
    $output .= "<b>Rt (SCIEX LCMS):</b> " . $LMCS_rf . "<br />";
    if ($LMCS_rf < 1.18 || $LMCS_rf > 3.72) {
    } else {
        predict($machine, $LMCS_rf, $percentACN, $output1);
        //echo "<br /><br />";
    }
}
function predict($machine, $LMCS_rf, &$percentACN, &$output1)
{
    if ($machine == "Prep_HPLC") {
        $percentACN = round(5.9864 * pow($LMCS_rf, 3) - 55.83 * pow($LMCS_rf, 2) + 188.76 * $LMCS_rf - 137.76, 1);
        $output1 .= "Ending Percent ACN is: " . $percentACN;
        $output1 .= "<br />";
        $output1 .= "<br />";
    }
    $output1;
}
?>
コード例 #2
0
ファイル: index.php プロジェクト: vivek-mishra04/test
 <div class="menu_nav">
      <div class="clr"></div>
  </div>
<div i
class="clr"></div>

  <div class="content">
      <div class="content_bg">
        <div class="mainbar">

          <?php 
include '../config.inc';
$USER_ID = $_SESSION["user_id"];
echo "<h2>Here are some recommendations for you:<br/>_______________ </h2><br/><br/>";
for ($BOOK_ID = 1; $BOOK_ID <= 10; $BOOK_ID++) {
    $value = predict($USER_ID, $BOOK_ID);
    $threshold = 5;
    $img = mysql_query("SELECT BOOK_IMG FROM bookinfo WHERE BOOK_ID={$BOOK_ID}");
    if ($threshold < $value) {
        $BOOK_NAME_RESULT = mysql_query("SELECT BOOK_NAME, BOOK_AUTHOR FROM bookinfo WHERE BOOK_ID={$BOOK_ID}");
        $BOOK_NAME_RESULT_ROW = mysql_fetch_assoc($BOOK_NAME_RESULT);
        $BOOK_NAME = $BOOK_NAME_RESULT_ROW["BOOK_NAME"];
        $BOOK_AUTHOR = $BOOK_NAME_RESULT_ROW["BOOK_AUTHOR"];
        echo $BOOK_NAME . " by " . $BOOK_AUTHOR . "<br/><br/>";
        //echo "The predicted rating for the book<a href=\"http://localhost/projectNew/bookInfo.php?book_id=".$BOOK_ID."\"> ".$BOOK_ID."</a> is";
        //echo $value."<br/>";
    }
    //else
    //echo "do not recommend  <br />";
}
function predict($USER_ID, $BOOK_ID)
コード例 #3
0
ファイル: NormalPhase.php プロジェクト: dwebber1/RetetionTime
$ending_percent = 0;
$run_time = 0;
$output1 = "";
$flow_rate = 0;
$max_loading = 0;
if ($solvent_system != "" && $tlc_rf != "") {
    $output = "";
    $output .= "<b>For the system:</b> <br />";
    $output .= "<b>TLC Solvent System:</b> " . $solvent_system . "<br />";
    $output .= "<b>Column:</b> " . $column_s . "<br />";
    $output .= "<b>Rf (TLC):</b> " . $tlc_rf . "<br />";
    $output .= "<br />";
    if ($tlc_rf < 0.2 || $tlc_rf > 0.6) {
        //echo "Rf must fall within range: 0.2 >= Rf <= 0.6";
    } else {
        predict($solvent_system, $tlc_rf, $column_s, $starting_percent, $grad_starting_time, $ending_percent, $grad_ending_time, $run_time, $output1, $flow_rate, $max_loading);
        //echo "<br /><br />";
    }
}
function roundDownToAny($n, $x = 5)
{
    return round($n) % $x === 0 ? round($n) : round(($n - $x / 2) / $x) * $x;
}
function predict($solvent_system, $tlc_rf, $column_s, &$starting_percent, &$grad_starting_time, &$ending_percent, &$grad_ending_time, &$run_time, &$output1, &$flow_rate, &$max_loading)
{
    $run_time = 27;
    $grad_starting_time = 3;
    $grad_ending_time = 13;
    if ($column_s == "12g") {
        $grad_starting_time = 2;
        $grad_ending_time = 8;
コード例 #4
0
<pre>
<?php 
include 'classifier.php';
// train or load an NGram profile, note a model will not be able to deal with languages it has not seen during training and
// will gladly misclassify any such language as one it has seen during training.
$classifier = new NGramProfiles('etc/classifiers/ngrams.dat');
if (!$classifier->exists()) {
    $classifier->train('en', 'etc/data/english.raw');
    $classifier->train('nl', 'etc/data/dutch.raw');
    $classifier->train('fr', 'etc/data/french.raw');
    $classifier->save();
} else {
    $classifier->load();
}
// simple prediction function that takes a classifier and a text and echo's the most likely language
function predict($classifier, $text)
{
    $language = $classifier->predict($text);
    echo "{$language} = '{$text}'\n";
}
predict($classifier, "Dit is een nederlandse text.");
predict($classifier, "This is an english text.");
predict($classifier, "Ceci n'est pas une pipe.");
コード例 #5
0
ファイル: predict.php プロジェクト: Alzheimers480/docker
<?php

require "index.php";
function predict($file, $user)
{
    $guess = exec("/var/www/facerec/faces predict " . $file . " " . $user, $output);
    $guess = $output[0];
    $conn = connectToDB();
    $sql = "SELECT ACQUAINTANCE_FNAME, ACQUAINTANCE_LNAME, GENDER, RELATION, DESCRIPTION, ACQUAINTANCE_UID FROM RELATIONSHIP NATURAL JOIN ACQUAINTANCE WHERE USER_UID = '" . $user . "' AND REL_ID=" . $guess . ";";
    $result = $conn->query($sql);
    $row = $result->fetch_assoc();
    $row["DISTANCE"] = $output[1];
    echo json_encode($row);
}
$filep = $_FILES['pic']['tmp_name'];
$userid = $_POST['USERNAME'];
predict($filep, $userid);
コード例 #6
0
<?php

include 'function.php';
for ($i = 1; $i <= 5; $i++) {
    for ($j = 1; $j <= 20; $j++) {
        echo 'User Id =' . $i . ' --- ' . 'Book Id =' . $j . ' --- ' . predict($i, $j) . '<br>';
    }
}
コード例 #7
0
ファイル: recommender1.php プロジェクト: vivek-mishra04/test
        mysql_query($sql, $connection);
        if ($itemID != $other_itemID) {
            $sql = "UPDATE dev SET count=count+1,\n\t    sum=sum-{$rating_difference}\n\t    WHERE (itemID1={$other_itemID} AND itemID2={$itemID})";
            mysql_query($sql, $connection);
        }
    } else {
        $sql = "INSERT INTO dev VALUES ({$itemID}, {$other_itemID},\n        1, {$rating_difference})";
        mysql_query($sql, $connection);
        if ($itemID != $other_itemID) {
            $sql = "INSERT INTO dev VALUES ({$other_itemID},\n\t    {$itemID}, 1, -{$rating_difference})";
            mysql_query($sql, $connection);
        }
    }
}
for ($x = 1; $x <= 3; $x++) {
    $value = predict(1, $x);
    $threshold = 5;
    echo "the predicted rating for the item is";
    echo $value . "<br />";
    if ($threshold < $value) {
        echo "recommend item <br /> ";
    } else {
        echo "do not recommend  <br />";
    }
}
function predict($userID, $itemID)
{
    global $connection;
    $denom = 0.0;
    $numer = 0.0;
    $k = $itemID;
コード例 #8
0
<pre>
<?php 
include 'classifier.php';
$classifier = new NGramProfiles('etc/classifiers/full.dat');
$classifier->train('en', 'etc/data/english.raw');
$classifier->train('nl', 'etc/data/dutch.raw');
$classifier->train('fr', 'etc/data/french.raw');
$classifier->train('de', 'etc/data/german.raw');
$classifier->train('id', 'etc/data/indonesian.raw');
$classifier->train('jp', 'etc/data/japanese.raw');
$classifier->train('pt', 'etc/data/portugese.raw');
$classifier->train('es', 'etc/data/spanish.raw');
$classifier->save();
// simple prediction function that takes a classifier and a text and echo's the most likely language
function predict($classifier, $text, $result)
{
    $language = $classifier->predict($text);
    echo "{$language} = {$result} @ '{$text}'\n";
}
predict($classifier, "Dit is een nederlandse text.", 'nl');
predict($classifier, "This is an english text.", 'en');
predict($classifier, "Ceci n'est pas une pipe.", 'fr');
predict($classifier, "dies ist ein Satz auf Deutsch", 'de');
predict($classifier, "esta es una frase en alemán", 'es');
コード例 #9
0
    }
    echo json_encode(array("Movie" => $picked_list));
} else {
    // rating array got, call predict function
    $rating_array = json_decode($query, true);
    if ($rating_array == null) {
        echo "failed to parse json string.";
        echo "<br>";
        echo $query;
        return;
    }
    if ($rating_array[0] == null or $rating_array[0]['id'] == null or $rating_array[0]['rating'] == null) {
        echo "json should be an array, each element of the array should contain key \"id\" and key \"rating\"";
        return;
    }
    $predict_array = predict($rating_array);
    $predict_array = array("Movie" => $predict_array);
    $json = json_encode($predict_array);
    echo $json;
}
function movie_ls()
{
    // return movie list
    // return array ("id" => "movie_string")
    $file = fopen("movie_ids.txt", "r") or die("Unable to open movie_ids.txt");
    $ans = array();
    while (!feof($file)) {
        $line = fgets($file);
        $row = preg_split("/ /", $line, 2);
        $row[1] = rtrim($row[1], "\n");
        $item = array("id" => $row[0], "title" => $row[1]);