-franciskane-
-
Posts
17 -
Joined
-
Last visited
Posts posted by -franciskane-
-
-
Hello! I found this code from github. https://github.com/gburtini/Learning-Library-for-PHP and I want to know if its possible to add variables to it and what changes needed to be done to the whole script.
My first guess is the variables are$xs
and
$ys
I want replace them and add two more. The whole code is here:
<?php require_once 'function.php'; function ll_nn_predict($xs, $ys, $row, $k) { $distances = ll_nearestNeighbors($xs, $row); $distances = array_slice($distances, 0, $k); $predictions = array(); foreach($distances as $neighbor=>$distance) { $predictions[$ys[$neighbor]]++; } asort($predictions); return $predictions; } function ll_nearestNeighbors($xs, $row) { $testPoint = $xs[$row]; $distances = _ll_distances_to_point($xs, $testPoint); return $distances; } function _ll_distances_to_point($xs, $x) { $distances = array(); foreach($xs as $index=>$xi) { $distances[$index] = ll_euclidean_distance($xi, $x); } asort($distances); array_shift($distances); return $distances; }
and the function.php that is required is this:
<?php function ll_transpose($rows) { $columns = array(); for($i=0;$i<count($rows);$i++) { for($k = 0; $k<count($rows[$i]); $k++) { $columns[$k][$i] = $rows[$i][$k]; } } return $columns; } function ll_mean($array) { return array_sum($array)/($array); } function ll_variance($array) { $mean = ll_mean($array); $sum_difference = 0; $n = count($array); for($i=0; $i<$n; $i++) { $sum_difference += pow(($array[$i] - $mean),2); } $variance = $sum_difference / $n; return $variance; } function ll_euclidean_distance($a, $b) { if(count($a) != count($b)) return false; $distance = 0; for($i=0;$i<count($a);$i++) { $distance += pow($a[$i] - $b[$i], 2); } return sqrt($distance); }
I just want to know where is the variables in those 2 scripts and add more as I'm not well versed in using PHP. Thank you!
-
@requinixI think my friend has already done that part. that's why the code is the only thing missing. since the algorithm is already available from the published paper.
-
@requinix The project is about attendance tracking through wifi fingerprinting based on a published paper that I posted in my original question months ago.
The project aims to track the log in and log out time of the faculty members of a school and determine the accuracy of location estimation using QR code and WIFI RSS Fingerprinting. -
@requinix We just need help with the algorithm itself. and how to use the values that were mentioned above.
@gw1500se Room 413 and 415 will be tested independently. This was supposed to be implemented on the whole building but for now only 2 rooms will be used first. And AP 1 and 2 for each room will also be tested. (I apologize in advance if I answered your question differently, English is not my main language)
-
I made a post a while back about this topic here:
and I've clarified a few things with my friend.1. The input from the project will be coming from a mobile app which will be using a qr code. The qr code contains the Room Number and the 2 Access Points for each room. When a user scans the qr code it will pass that info to the web app that has the algorithm and verify what room he/she is in the access point that was 'scanned'.
2. For the testing of the project we decided to use two rooms of the building of our alma mater and the access points were already defined based on tests:
Room 413 has Access Point 1 that have the values of -67 dBm to -89 dBm and Access Point 2 that have the values of -40 dbm to -57 dBm while
Room 415 has Access Point 1 that have the values of -30 dBm to -46 dBm and Access Point 2 that have the values of -75 dBm to -100 dBm3. I already inputted the values and the rooms I've mentioned above in mysql to verify if the input from the qr code that was scanned it correct. but sadly we are stuck with the algorithm itself.
-
On 8/19/2020 at 9:18 PM, gw1500se said:
She can't make up test data?
The only part the we can make test data for (that I know of) is the login credentials from the db of the website that will also be used by the mobile app. And I wouldn't know how would you test a qr scanner without being there.
-
20 hours ago, gw1500se said:
No, we need to see the actual output and how it plans to call the PHP script. However, it does look like JSON was the intention.
Ohh. Ok I get it. We aren't on that phase yet because of the pandemic. My friend can't go to our alma mater yet to test the QR Scanner. We are hoping to finish everything first before she can test the mobile app and the website. then debug.
-
-
On 8/15/2020 at 11:34 PM, gw1500se said:
Language doesn't matter. What I want to see is the JSON output or whatever she programmed to be passed to the PHP script. It would be preferable if she programmed it to output it in JSON.
Hello I have the c# files. but I cant upload them here. and from browsing those files I can't find any json file so maybe that she hasn't finished that part. I thought that I can finish first this algorithm then try to connect the website to the mobile app. but I guess my reasoning is wrong.
-
22 hours ago, gw1500se said:
I think you need to start on the mobile side and, as gizmola suggested, create the json formatted data. Post a sample of that so we get a better idea of what it looks like and then we can help you go from there with the PHP side.
Hello my friend said the she wrote the mobile app's source code in unity
-
3 minutes ago, gw1500se said:
I think you need to start on the mobile side and, as gizmola suggested, create the json formatted data. Post a sample of that so we get a better idea of what it looks like and then we can help you go from there with the PHP side.
Ok. I'll get the source code of the mobile app from my friend (because she's the one that developed it.) thanks!
and we haven't yet tested how the mobile app and the web app will 'meet' -
4 minutes ago, gizmola said:
The way that the client/mobile app and the serverside routines will work, need to implement some sort of standard. My suggestion would be that you utilize json. So the webapp should send it's data to the web app in json format. In PHP it is then simply a function call (json_decode) in order to convert the data into either php objects or a php array.
Hello! The php script that you sent. is there anything to add there or can we use that as is? and that will be incorporated into json? did I get that right?
-
-
12 hours ago, gw1500se said:
1 and 2 would presumably be input from the web page. The rest would be something like:
for ($m=1; $m<=$M; $m++) { for ($l=1; $l<=$L; $l++) { for ($j=1; $j<=$N; $j++) { #do calculation here storing it in a 2D array } # select minimum here (perhaps min() function) } } # use array sort # use PHP vector class # compute distance from vectors # echo results in desired format
In our project the input will be coming from a mobile app that my friend made that scans a room. I don't if its needed but I can provide the documentation of the project here.
-
10 hours ago, gw1500se said:
I assumed that they knew how to calculate the distance and just needed some pointers on how to structure the algorithm in PHP.
Yes! since the formula is (I assume) indicated in the pseudocode. the translation of it to PHP is what we needed. Thank you!
-
I'm helping a friend in developing a project for our alma mater. And its based on this paper: An Enhanced Indoor Positioning Method Based on Wi-Fi RSS Fingerprinting
So far 80% of the web app is finished except for the algorithm (We have no experience with algorithms to source code translations) that needs to be implemented in the website. Inside this paper there is this algorithm that the proponents of the research used. (attached as screenshot).
The algorithm was converted to code by using MATLAB, but we are trying to use PHP with our project. Based on the pseudo code the calculation of the Euclidean Distance is the core of it. Can anyone help us with the translation just to get it started.
Adding Variables to an existing PHP Script(s)
in PHP Coding Help
Posted
@gw1500sehello! Those 4 variables' data will be coming from a database but will be split into pairs. The first pair of variables will be coming from a mobile app. then the second pair will be already saved in the database and will be used as the data(s) to be compared to the first pair of variables. Or at least its what we intended to happen.