Coder Social home page Coder Social logo

kootenpv / whereami Goto Github PK

View Code? Open in Web Editor NEW
5.1K 102.0 249.0 66 KB

Uses WiFi signals :signal_strength: and machine learning to predict where you are

License: GNU Affero General Public License v3.0

Python 100.00%
whereami wifi-signal access-point distance cross-platform indoor-positioning hacktoberfest hacktoberfest2021

whereami's Introduction

whereami

Build Status Coverage Status PyPI PyPI

Uses WiFi signals and machine learning (sklearn's RandomForest) to predict where you are. Even works for small distances like 2-10 meters.

Your computer will known whether you are on Couch #1 or Couch #2.

Cross-platform

Works on OSX, Windows, Linux (tested on Ubuntu/Arch Linux).

The package access_points was created in the process to allow scanning wifi in a cross platform manner. Using access_points at command-line will allow you to scan wifi yourself and get JSON output. whereami builds on top of it.

Installation

pip install whereami

Usage

# in your bedroom, takes a sample
whereami learn -l bedroom

# in your kitchen, takes a sample
whereami learn -l kitchen

# get a list of already learned locations
whereami locations

# cross-validated accuracy on historic data
whereami crossval
# 0.99319

# use in other applications, e.g. by piping the most likely answer:
whereami predict | say
# Computer Voice says: "bedroom"

# probabilities per class
whereami predict_proba
# {"bedroom": 0.99, "kitchen": 0.01}

If you want to delete some of the last lines, or the data in general, visit your $USER/.whereami folder.

Python

Any of the functionality is available in python as well. Generally speaking, commands can be imported:

from whereami import learn
from whereami import get_pipeline
from whereami import predict, predict_proba, crossval, locations

Accuracy

k Generally it should work really well. I've been able to learn using only 7 access points at home (test using access_points -n). At organizations you might see 70+.

Distance: anything around ~10 meters or more should get >99% accuracy.

If you're adventurous and you want to learn to distinguish between couch #1 and couch #2 (i.e. 2 meters apart), it is the most robust when you switch locations and train in turn. E.g. first in Spot A, then in Spot B then start again with A. Doing this in spot A, then spot B and then immediately using "predict" will yield spot B as an answer usually. No worries, the effect of this temporal overfitting disappears over time. And, in fact, this is only a real concern for the very short distances. Just take a sample after some time in both locations and it should become very robust.

Height: Surprisingly, vertical difference in location is typically even more distinct than horizontal differences.

Related Projects

  • The wherearehue project can be used to toggle Hue light bulbs based on the learned locations.

Almost entirely "copied" from:

https://github.com/schollz/find

That project used to be in Python, but is now written in Go. whereami is in Python with lessons learned implemented.

Tests

It's possible to locally run tests for python 2.7, 3.4 and 3.5 using tox.

git clone https://github.com/kootenpv/whereami
cd whereami
python setup.py install
tox

whereami's People

Contributors

allanlrh avatar andrewdessin avatar christopherki avatar hugovk avatar kootenpv avatar stefanhuber1993 avatar timotk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

whereami's Issues

Support for different floors, aka 3D triangulation.

Hello, assume that a two story square shaped house has eight rooms:
First floor: kitchen, living room,guest room, bathroom 1
Second floor: master bedroom, bathroom 2,kid room1, office.

Each rooms outermost corner ( away from the houses center) has a raspberry pi that listens to the WiFi.

It should then be possible to triangulate in 3D.

Locations lose trailing 't' or 'x'

The names of locations lose any number of trailing 't' or 'x' characters, e.g.

$ whereami learn -l couch-right &>/dev/null
$ whereami locations
couch-righ: 1

This is due to using rstrip(".txt") on the filename at get_data.py:42, which will strip any number of '.', 't', or 'x' characters.

Unable to run whereami from a launch agent

I use a Launch Agent to run a bash script in a standard user account on macOS High Sierra. The bash script performs a series of tasks, which also includes collecting whereami results. If the bash script is initiated by the Launch Agent all tasks in the bash script complete as expected except the collection of whereami results. If I manually run the bash script all tasks complete as expected. Anyone have any ideas why the Launch Agent cannot run whereami? The Launch Agent is in /Users/name/Library/LaunchAgents/. Whereami is in /usr/local/bin. The permissions of /usr/local/bin/whereami is 755.

no module name sklearn

Hi

I keep getting this error, is there a list of dependencies that need to be installed first?

Thanks

Not working in Python 3.6

I have issues like when install in Arch with Python 3.6:

Exception:
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber
    ensure_dir(destdir)
  File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib/python3.6/os.py", line 220, in makedirs
    mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/lib/python3.6/site-packages/tqdm-4.11.2.dist-info'

Windows 10: ValueError: Found array with 0 feature(s) (shape=(100, 0)) while a minimum of 1 is required.

I'm using miniconda.

(py2) C:\Users\jane_>python --version
Python 2.7.12 :: Continuum Analytics, Inc.
(py2) C:\Users\jane_>conda list
# packages in environment at C:\Users\jane_\Miniconda3\envs\py2:
#
access-points             0.0.18                    <pip>
mkl                       11.3.3                        1
numpy                     1.11.1                   py27_1
pip                       8.1.2                    py27_0
python                    2.7.12                        0
scikit-learn              0.17.1              np111py27_1
scipy                     0.18.1              np111py27_0
setuptools                27.2.0                   py27_1
tqdm                      4.8.4                     <pip>
vs2008_runtime            9.00.30729.1                  2
wheel                     0.29.0                   py27_0
whereami                  0.2.29                    <pip>
(py2) C:\Users\jane_>whereami learn -l bookshelf -n 100
100%|################################################################################| 100/100 [00:14<00:00,  6.79it/s]
Traceback (most recent call last):
  File "c:\users\jane_\miniconda3\envs\py2\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\users\jane_\miniconda3\envs\py2\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Users\jane_\Miniconda3\envs\py2\Scripts\whereami.exe\__main__.py", line 9, in <module>
  File "c:\users\jane_\miniconda3\envs\py2\lib\site-packages\whereami\__main__.py", line 34, in main
    learn(args.location, args.num_samples)
  File "c:\users\jane_\miniconda3\envs\py2\lib\site-packages\whereami\learn.py", line 25, in learn
    train_model()
  File "c:\users\jane_\miniconda3\envs\py2\lib\site-packages\whereami\pipeline.py", line 33, in train_model
    lp.fit(X, y)
  File "c:\users\jane_\miniconda3\envs\py2\lib\site-packages\sklearn\pipeline.py", line 165, in fit
    self.steps[-1][-1].fit(Xt, y, **fit_params)
  File "c:\users\jane_\miniconda3\envs\py2\lib\site-packages\sklearn\ensemble\forest.py", line 212, in fit
    X = check_array(X, dtype=DTYPE, accept_sparse="csc")
  File "c:\users\jane_\miniconda3\envs\py2\lib\site-packages\sklearn\utils\validation.py", line 415, in check_array
    context))
ValueError: Found array with 0 feature(s) (shape=(100, 0)) while a minimum of 1 is required.

Allow to set several location regions

For example, you can be able to test not only on different couchs on the same room, but also define them on the same room so the train data apply to the bigger region too (couch1 + living, couch2 + living). It could be possible to return the different "closures" from more specific to more generic, or viceversa.

Update dependencies

On python3.3.6:

/usr/local/lib64/python3.6/site-packages/sklearn/ensemble/weight_boosting.py:29: DeprecationWarning: numpy.core.umath_tests is an internal NumPy module and should not be imported. It will be removed in a future NumPy release.
  from numpy.core.umath_tests import inner1d

ValueError: n_splits=10 cannot be greater than the number of members in each class.

When running whereami crossval, I get

ValueError: n_splits=10 cannot be greater than the number of members in each class.

I suspect this happens when the total number of samples is >= 10, but one of the locations has < 10 samples. This case should be checked for and handled gracefully the same way as the case when the total number of samples is < 10, i.e. not throw an exception.

How can I track my phone?

I would like to track my phone, to get its location and obtain RSSI values as well. How can it be done? Any ideas?

Ubuntu:ValueError: need more than 1 value to unpack

Hi,

Newbie here, I run the command "whereami learn -l bedroom -n 100" at first time, it got error as below:

0%| | 0/100 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/usr/local/bin/whereami", line 9, in
load_entry_point('whereami==0.3.50', 'console_scripts', 'whereami')()
File "/usr/local/lib/python2.7/dist-packages/whereami-0.3.50-py2.7.egg/whereami/main.py", line 39, in main
learn(args.location, args.num_samples)
File "/usr/local/lib/python2.7/dist-packages/whereami-0.3.50-py2.7.egg/whereami/learn.py", line 22, in learn
new_sample = sample()
File "/usr/local/lib/python2.7/dist-packages/whereami-0.3.50-py2.7.egg/whereami/get_data.py", line 15, in sample
aps = wifi_scanner.get_access_points()
File "/usr/local/lib/python2.7/dist-packages/access_points/init.py", line 77, in get_access_points
results = self.parse_output(out)
File "/usr/local/lib/python2.7/dist-packages/access_points/init.py", line 210, in parse_output
ssid, bssid, quality, security = split_escaped(line, ':')
ValueError: need more than 1 value to unpack

What kind of additional argument I should put in the command?

Thanks

Unrecognized Arguments -n

Hey there,

I was trying to use 'whereami'. I use python 2.7, and installed whereami by pip.
I get the following error message.

>>> whereami learn -l work2 -n 100
usage: whereami [-h] [--version]
                {predict,predict_proba,crossval,locations,ls,learn,rename} ...
whereami: error: unrecognized arguments: -n 100

Best
Stefan

(Py3) missing requirements

In a clean environment, the installation did not work. See below (slightly redacted for clarity).

❯ pip install whereami
Could not find an activated virtualenv (required).



❯ pyvenv-3.5 tmp/py-master



❯ . ./tmp/py3/bin/activate

(py3) ❯ pip install whereami
Collecting whereami
  Downloading whereami-0.2.21-py2.py3-none-any.whl
Collecting tqdm (from whereami)
  Downloading tqdm-4.8.4-py2.py3-none-any.whl
Collecting access-points (from whereami)
  Downloading access_points-0.0.11-py2.py3-none-any.whl
Collecting scikit-learn (from whereami)
  Downloading scikit_learn-0.17.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.7MB)
Installing collected packages: tqdm, access-points, scikit-learn, whereami
Successfully installed access-points-0.0.11 scikit-learn-0.17.1 tqdm-4.8.4 whereami-0.2.21
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.



(py3) ❯ rehash



(py3) ❯ whereami
Traceback (most recent call last):
  File "/Users/konrad/tmp/py3/bin/whereami", line 7, in <module>
    from whereami.__main__ import main
  File "/Users/konrad/tmp/py3/lib/python3.5/site-packages/whereami/__main__.py", line 1, in <module>
    from whereami.predict import predict
  File "/Users/konrad/tmp/py3/lib/python3.5/site-packages/whereami/predict.py", line 3, in <module>
    from whereami.pipeline import get_model
  File "/Users/konrad/tmp/py3/lib/python3.5/site-packages/whereami/pipeline.py", line 2, in <module>
    import numpy as np
ImportError: No module named 'numpy'



(py3) ❯ pip install numpy
Collecting numpy
  Downloading numpy-1.11.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.9MB)
Installing collected packages: numpy
Successfully installed numpy-1.11.1
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.



(py3) ❯ whereami
Traceback (most recent call last):
  File "/Users/konrad/tmp/py3/bin/whereami", line 7, in <module>
    from whereami.__main__ import main
  File "/Users/konrad/tmp/py3/lib/python3.5/site-packages/whereami/__main__.py", line 1, in <module>
    from whereami.predict import predict
  File "/Users/konrad/tmp/py3/lib/python3.5/site-packages/whereami/predict.py", line 3, in <module>
    from whereami.pipeline import get_model
  File "/Users/konrad/tmp/py3/lib/python3.5/site-packages/whereami/pipeline.py", line 3, in <module>
    from sklearn.ensemble import RandomForestClassifier
  File "/Users/konrad/tmp/py3/lib/python3.5/site-packages/sklearn/__init__.py", line 57, in <module>
    from .base import clone
  File "/Users/konrad/tmp/py3/lib/python3.5/site-packages/sklearn/base.py", line 9, in <module>
    from scipy import sparse
ImportError: No module named 'scipy'



(py3) ❯ pip install scipy
Collecting scipy
  Downloading scipy-0.18.1-cp35-cp35m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (21.0MB)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.7.1 in ./tmp/py3/lib/python3.5/site-packages (from scipy)
Installing collected packages: scipy
Successfully installed scipy-0.18.1
You are using pip version 8.1.1, however version 8.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.



(py3) ❯ whereami
usage: whereami [-h] {predict,predict_proba,crossval,learn} ...

Uses WiFi signals and machine learning to predict where you are.
Feel free to try out commands, if anything is missing it will print help.

You will want to start with `whereami learn`

positional arguments:
  {predict,predict_proba,crossval,learn}

optional arguments:
  -h, --help            show this help message and exit



(py3) ❯ python --version
Python 3.5.2



(py3) ❯ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: OS X 10.11.6 (15G1004)
      Kernel Version: Darwin 15.6.0
      (…)

(Py3) bad command line in examples

Just installed (few minutes after #3).

(py3) ❯ whereami learn bed 100
usage: whereami learn [-h] --location LOCATION [--num_samples NUM_SAMPLES]
whereami learn: error: the following arguments are required: --location/-l



(py3) ❯ whereami learn --location bed --num_samples 100
[this works]



(py3) ❯ pip freeze
access-points==0.0.11
numpy==1.11.1
scikit-learn==0.17.1
scipy==0.18.1
tqdm==4.8.4
whereami==0.2.21

missing documentation for mac 10.11.6

Installed with sudo pip install -U whereami with system's python. My current locations are :

shop-bedroom-bed: 8
shop-window: 5
shop-couch: 4
shop-frontporch: 3
shop-kitchen: 4
shop-bathroom: 2
shop-backporch: 3
shop-bedroom-desk: 5

When I run whereami crossval, I get a stacktrace ending with ValueError: n_splits=10 cannot be greater than the number of members in each class. I'm not sure how to fix this error, but in searching around for a fix, I feel like the existing project documentation could be a little clearer, e.g., where the trained data is, whether it's different from data in ~/.whereami/*.txt, what exactly whereami train does, what's the benefit of the -n 4 samples option, and how to use the rename option. If this is already documented, could you please point me in the right direction?

EDIT for the n_splits error, this link https://stackoverflow.com/questions/48313387/valueerror-n-splits-10-cannot-be-greater-than-the-number-of-members-in-each-cla is helpful.

So it follows that one benefit of setting samples option during learn is that one sooner reaches the minimum of 10 samples necessary to run whereami crossval.

UnicodeDecodeError when learning

When running whereami learn -l bedroom on Windows 10 with Python 3.5.0 I get this error:


Traceback (most recent call last):
  File "c:\python35\lib\site-packages\access_points\__init__.py", line 14, in ensure_str
    output = output.decode("utf8")
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 12: invalid start byte

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\python35\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python35\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python35\Scripts\whereami.exe\__main__.py", line 9, in <module>
  File "c:\python35\lib\site-packages\whereami\__main__.py", line 80, in main
    learn(args.location, args.num_samples, args.device)
  File "c:\python35\lib\site-packages\whereami\learn.py", line 26, in learn
    new_sample = sample(device)
  File "c:\python35\lib\site-packages\whereami\get_data.py", line 15, in sample
    aps = wifi_scanner.get_access_points()
  File "c:\python35\lib\site-packages\access_points\__init__.py", line 80, in get_access_points
    results = self.parse_output(ensure_str(out))
  File "c:\python35\lib\site-packages\access_points\__init__.py", line 16, in ensure_str
    output = output.decode("utf16")
  File "c:\python35\lib\encodings\utf_16.py", line 16, in decode
    return codecs.utf_16_decode(input, errors, True)
UnicodeDecodeError: 'utf-16-le' codec can't decode byte 0x0a in position 84: truncated data

Is this a known error? Is there any idea how to fix this?
Thanks!

What can I do with this?

I like the idea of whereami, and it's pretty accurate. Only problem is that I don't know what to do with it. Any ideas?

Does deleting {{location}}.txt files affect the model?

I am trying to delete a single location... I deleted its relevant .txt file but running a prediction still shows the model predicting I am in that location.

Am I doing something wrong or should I take a different approach to deleting a location? (Assuming it is possible within the current library).

Thanks for any help!!

Integer parsing error upon First Sampling

Hi, I just tried to run whereami for the first time, and I got the following strange error:

peachg@deino ~/P/blog_os> whereami learn -l my_room
  2%|▊                                          | 2/100 [00:07<06:15,  3.83s/it]
Traceback (most recent call last):
  File "/usr/local/bin/whereami", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/whereami/__main__.py", line 34, in main
    learn(args.location, args.num_samples)
  File "/usr/local/lib/python2.7/site-packages/whereami/learn.py", line 22, in learn
    write_data(label_path, sample())
  File "/usr/local/lib/python2.7/site-packages/whereami/get_data.py", line 14, in sample
    aps = wifi_scanner.get_access_points()
  File "/usr/local/lib/python2.7/site-packages/access_points/__init__.py", line 33, in get_access_points
    results = self.parse_output(out)
  File "/usr/local/lib/python2.7/site-packages/access_points/__init__.py", line 62, in parse_output
    ap = AccessPoint(ssid, bssid, rssi_to_quality(int(rssi)), security)
ValueError: invalid literal for int() with base 10: ''

Python 2.7, OSX 10.11.6.

Does not refresh locations between each sample (Win 10)

In windows 10, Wi-Fi sampling must be done between every iteration. Otherwise, the method used here will return data of the same values, and there is no point in collecting n-records. It will all represent a single value. The program needs to call the Windows API to refresh the API points before gathering a new sample.

OSX error

"This module will be removed in 0.20.", DeprecationWarning)
 21%|████████▊                                 | 21/100 [00:32<02:03,  1.57s/it]
Traceback (most recent call last):
  File "/usr/local/bin/whereami", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/whereami/__main__.py", line 34, in main
    learn(args.location, args.num_samples)
  File "/Library/Python/2.7/site-packages/whereami/learn.py", line 22, in learn
    write_data(label_path, sample())
  File "/Library/Python/2.7/site-packages/whereami/get_data.py", line 14, in sample
    aps = wifi_scanner.get_access_points()
  File "/Library/Python/2.7/site-packages/access_points/__init__.py", line 34, in get_access_points
    results = self.parse_output(out)
  File "/Library/Python/2.7/site-packages/access_points/__init__.py", line 60, in parse_output
    for network in read_plist(output):
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 103, in readPlistFromString
    return readPlist(StringIO(data))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 78, in readPlist
    rootObject = p.parse(pathOrFile)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 406, in parse
    parser.ParseFile(fileobj)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1038, column 10

add a time dimension to locations?

Ambient conditions (fog, storms, air quality, etc.) regularly affect radio transmissions in the suburban neighborhoods I've lived at. Some ambient conditions--like storms and fog--occur less regularly than the nighttime drops in temperature and humidity. (On the average, for any given geographic location, temperature and humidity are correlated by time of day.) The influences of ambient conditions on wifi RSSI will be less pronounced in denser, urban environments than suburban environments. The same goes for more climate-controlled environments (large libraries, universities, etc.). So, this may not be applicable in all use cases.

Nonetheless, given this time constant, I think factoring time-of-day into measurements and samples would be an interesting and useful addition to the project. I've kinda implemented this by changing the names of my classes, e.g., "shop-bedroom-day" and "shop-bedroom-night" or "shop-office-day" and "shop-office-night."

Is there a way the project could make this more formal? Like, adding a time-of-day component to locations?

nonfunctional due to alternative wifi device name

Hi,

i'm trying to get whereami working on ubuntu zesty, the current package version is 0.34

out of the box, there is no real functionality, whereami appears to take whatever argument i feed it as a location e.g.
~#whereami locations
Moving from home to locations

Since i also get "eth0: Error while getting interface flags: no such device"

i think the problem might be that #1 since i have a loptop without a network port there is no eth0 and #2 since my wifi device is called wlp2s0 instead of wlan0 whereami does not know where to look for an environmen.

Some indication from the application that its not seeing any network would be nice, also some guidance on how to change the network device name correctly would be great

Don't show stacktrace when using Ctrl-C

If you run whereami predict and before is has finished you press Ctrl+C to kill the execution you get a Python stacktrace.

$ whereami predict
^CTraceback (most recent call last):
  File "/Users/user/anaconda3/bin/whereami", line 11, in <module>
    sys.exit(main())
  File "/Users/user/anaconda3/lib/python3.5/site-packages/whereami/__main__.py", line 77, in main
    print(predict(args.input_path, args.model_path, args.device))
  File "/Users/user/anaconda3/lib/python3.5/site-packages/whereami/predict.py", line 17, in predict
    data_sample = sample(device) if input_path is None else get_external_sample(input_path)
  File "/Users/user/anaconda3/lib/python3.5/site-packages/whereami/get_data.py", line 15, in sample
    aps = wifi_scanner.get_access_points()
  File "/Users/user/anaconda3/lib/python3.5/site-packages/access_points/__init__.py", line 79, in get_access_points
    out = self.call_subprocess(self.cmd)
  File "/Users/user/anaconda3/lib/python3.5/site-packages/access_points/__init__.py", line 86, in call_subprocess
    (out, _) = proc.communicate()
  File "/Users/user/anaconda3/lib/python3.5/subprocess.py", line 1059, in communicate
    stdout = self.stdout.read()
KeyboardInterrupt```

Embedd in Python Code

Hi,
I did not find any documentation on using this module from other Python code. When importing it does not expose any functionality. Would it be possible to allow other modules to work with whereami ?

Reset knowledge

Wonderful piece of software, thank you! I'm using on a Raspberry.
Ho can I delete all the training information to start from scratch?
Or delete one (or more) location?
Thank you

ValueError: Valid presets for class_weight include "auto" and "subsample". Given "balanced".

Hello,

I'm running on Windows 7, Python 3.4.3. I've got a ValueError while trying to learn a location:

> whereami learn -l my_desk -n 100
100%|################################################################################################| 100/100 [00:26<00:00,  3.80it/s] Traceback (most recent call last):
  File "c:\python34\lib\runpy.py", line 170, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\python34\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python34\Scripts\whereami.exe\__main__.py", line 9, in <module>
  File "c:\python34\lib\site-packages\whereami\__main__.py", line 45, in main
    learn(args.location, args.num_samples)
  File "c:\python34\lib\site-packages\whereami\learn.py", line 27, in learn
    train_model()
  File "c:\python34\lib\site-packages\whereami\pipeline.py", line 29, in train_model
    lp.fit(X, y)
  File "c:\python34\lib\site-packages\sklearn\pipeline.py", line 141, in fit
    self.steps[-1][-1].fit(Xt, y, **fit_params)
  File "c:\python34\lib\site-packages\sklearn\ensemble\forest.py", line 218, in fit
    y, expanded_class_weight = self._validate_y_class_weight(y)
  File "c:\python34\lib\site-packages\sklearn\ensemble\forest.py", line 417, in _validate_y_class_weight
    % self.class_weight)
ValueError: Valid presets for class_weight include "auto" and "subsample". Given "balanced".

This is the first time I'm submitting an issue on Github. Please let me know if I can provide additional information.

Thank you kindly,
George

ValueError: Sample sequence X is empty

I'm tried to run whereami learn -l test_location -n 100 and get following error:

➜  test git:(master) ✗ whereami learn -l test_location -n 100
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 100/100 [00:01<00:00, 53.30it/s]
Traceback (most recent call last):
  File "/usr/local/bin/whereami", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/site-packages/whereami/__main__.py", line 39, in main
    learn(args.location, args.num_samples)
  File "/usr/local/lib/python3.5/site-packages/whereami/learn.py", line 27, in learn
    train_model()
  File "/usr/local/lib/python3.5/site-packages/whereami/pipeline.py", line 27, in train_model
    lp.fit(X, y)
  File "/usr/local/lib/python3.5/site-packages/sklearn/pipeline.py", line 268, in fit
    Xt, fit_params = self._fit(X, y, **fit_params)
  File "/usr/local/lib/python3.5/site-packages/sklearn/pipeline.py", line 234, in _fit
    Xt = transform.fit_transform(Xt, y, **fit_params_steps[name])
  File "/usr/local/lib/python3.5/site-packages/sklearn/feature_extraction/dict_vectorizer.py", line 231, in fit_transform
    return self._transform(X, fitting=True)
  File "/usr/local/lib/python3.5/site-packages/sklearn/feature_extraction/dict_vectorizer.py", line 184, in _transform
    raise ValueError("Sample sequence X is empty.")
ValueError: Sample sequence X is empty.

OS version: macOS 10.12.1
Python version: 3.5.2

(Python 2.7) predict_proba throws AttributeError

Running OS X El Capitan (10.11.6), Python 2.7.11, whereami 0.1.17

predict works properly, but predict_proba makes the calculations (which I can tell because it takes a few seconds) and then throws an AttributeError.

Rogers-MacBook-Air:~ roger$ whereami predict_proba
Traceback (most recent call last):
  File "/Users/roger/anaconda/bin/whereami", line 11, in <module>
    sys.exit(main())
  File "/Users/roger/anaconda/lib/python2.7/site-packages/whereami/__main__.py", line 10, in main
    predict_proba()
  File "/Users/roger/anaconda/lib/python2.7/site-packages/whereami/predict.py", line 9, in predict_proba
    print({x: y for x, y in zip(lp.clf.classes_, lp.predict_proba(sample())[0])})
AttributeError: 'Pipeline' object has no attribute 'clf'

Installing whereami on MacBook with M1 Chip running Big Sur

Hi, I'm hoping I can get some help with an installation issue. I have python3.8 and Whereami running perfectly on a Catalina device. I recently tried installing it on an M1 MacBook running Big Sur, but was unsuccessful. I have python3.9 installed on BigSur. When I run the command pip3 install whereami, it hangs at:

ERROR: Failed building wheel for numpy
Failed to build numpy
ERROR: Could not build wheels for numpy which uses PEP 517 and cannot be installed directly

If anyone has advice about how I can fix this problem, I would greatly appreciate it!

whereami rename old_label new_label not working

If I run the following command "whereami rename old_label new_label" terminal outputs "whereami: error: unrecognized arguments: old_label new_label". Any advice for me?

I'm running:
OSX High Sierra
Python3.8.6
PIP3
whereami version 0.4.85

Access Point: ValueError: not enough values to unpack (expected 4, got 1)

Hello, kootenpv.
First of all, creating thanks for the project!

Kootenpv, every time I try to learn (e.g. whereami learn -l bedroom) I get the following error:

0%| | 0/100 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/lucas/anaconda3/bin/whereami", line 11, in
sys.exit(main())
File "/home/lucas/anaconda3/lib/python3.5/site-packages/whereami/main.py", line 39, in main
learn(args.location, args.num_samples)
File "/home/lucas/anaconda3/lib/python3.5/site-packages/whereami/learn.py", line 22, in learn
new_sample = sample()
File "/home/lucas/anaconda3/lib/python3.5/site-packages/whereami/get_data.py", line 15, in sample
aps = wifi_scanner.get_access_points()
File "/home/lucas/anaconda3/lib/python3.5/site-packages/access_points/init.py", line 77, in get_access_points
results = self.parse_output(out)
File "/home/lucas/anaconda3/lib/python3.5/site-packages/access_points/init.py", line 210, in parse_output
ssid, bssid, quality, security = split_escaped(line, ':')
ValueError: not enough values to unpack (expected 4, got 1)

I imported the project into PyCharm and all the tests were run successfuly. That seems weird.

Can we fix this?

nmcl: could not creat nmclient object

[ric@thinkfat ~]$ whereami learn -l esszimmer -n 100
0%| | 0/100 00:00<?, ?it/s: nmcli-CRITICAL **: Error: Could not create NMClient object: Method "GetAll" with signature "s" on interface "org.freedesktop.DBus.Properties" doesn't exist

Traceback (most recent call last):
File "/usr/bin/whereami", line 11, in
sys.exit(main())
File "/usr/lib/python3.5/site-packages/whereami/main.py", line 37, in main
learn(args.location, args.num_samples)
File "/usr/lib/python3.5/site-packages/whereami/learn.py", line 22, in learn
new_sample = sample()
File "/usr/lib/python3.5/site-packages/whereami/get_data.py", line 14, in sample
aps = wifi_scanner.get_access_points()
File "/usr/lib/python3.5/site-packages/access_points/init.py", line 67, in get_access_points
results = self.parse_output(out)
File "/usr/lib/python3.5/site-packages/access_points/init.py", line 200, in parse_output
ssid, bssid, quality, security = split_escaped(line, ':')
ValueError: not enough values to unpack (expected 4, got 1)

windows10,python2.7 error:UTF-16 surrogate

C:\Users\weizihan>whereami learn -l bed
0%| | 0/100 [00:00<?, ?it/s]
Traceback (most recent call last):
File "f:\python2\python2\lib\runpy.py", line 174, in run_module_as_main
"main", fname, loader, pkg_name)
File "f:\python2\python2\lib\runpy.py", line 72, in run_code
exec code in run_globals
File "F:\python2\python2\Scripts\whereami.exe_main
.py", line 9, in
File "f:\python2\python2\lib\site-packages\whereami_main
.py", line 39, in main
learn(args.location, args.num_samples)
File "f:\python2\python2\lib\site-packages\whereami\learn.py", line 22, in learn
new_sample = sample()
File "f:\python2\python2\lib\site-packages\whereami\get_data.py", line 15, in sample
aps = wifi_scanner.get_access_points()
File "f:\python2\python2\lib\site-packages\access_points_init_.py", line 79, in get_access_points
results = self.parse_output(ensure_str(out))
File "f:\python2\python2\lib\site-packages\access_points_init_.py", line 16, in ensure_str
output = output.decode("utf-16")
File "f:\python2\python2\lib\encodings\utf_16.py", line 16, in decode
return codecs.utf_16_decode(input, errors, True)
UnicodeDecodeError: 'utf16' codec can't decode bytes in position 94-95: illegal UTF-16 surrogate

How to fix this problem?Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.