Giter VIP home page Giter VIP logo

python-weka-wrapper3's Introduction

python-weka-wrapper3

Python wrapper for the Java machine learning workbench Weka using the python-javabridge library.

Requirements:

  • Python 3
    • python-javabridge (>= 4.0.0)
    • matplotlib (optional)
    • pygraphviz (optional)
    • PIL (optional)
    • lxml (optional)
  • OpenJDK 11 (or later)

Uses:

  • Weka (3.9.6)

Installation

Detailed instructions on installing the library on various operating systems are located here:

https://fracpete.github.io/python-weka-wrapper3/install.html

Please note, that you need a build environment to compile some libraries from source.

Docker

python-weka-wrapper3 also offers pre-built Docker images, making it easy to run the tool without having to install it. See here for more information.

Forum

You can post questions, patches or enhancement requests in the following Google Group:

https://groups.google.com/forum/#!forum/python-weka-wrapper

Examples

Documentation

The complete documentation for the library is available from here:

https://fracpete.github.io/python-weka-wrapper3/

Download statistics

For viewing recent download statistics, go to pypistats:

https://pypistats.org//api/packages/python-weka-wrapper3/recent

python-weka-wrapper3's People

Contributors

danielnsilva avatar fracpete avatar m-martin-j avatar malexmave avatar zhoufeng1989 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

python-weka-wrapper3's Issues

Error while installing python-javabridge

While doing pip install python-javabridge I get the following error:

ModuleNotFoundError: No module named 'numpy'

I have already install pip-23.3.2, numpy1-26-3 and added to the path python executable, (I am using python 3.12), and python scripts.

Logging level of other Python modules are affected

Hello,
Should we remove logging.basicConfig(level=logging.DEBUG) from python/weka/core/jvm.py:26?

This line changes the logging level for the global root logger, which may lead to unexpected verbose logs from other modules, for example, matplotlib:

>>> import weka.core.jvm
>>> import matplotlib
DEBUG:matplotlib:$HOME=C:\Users\Administrator
DEBUG:matplotlib:CONFIGDIR=C:\Users\Administrator\.matplotlib
DEBUG:matplotlib:matplotlib data path: c:\program files\python36\lib\site-packag
es\matplotlib\mpl-data
DEBUG:matplotlib:loaded rc file c:\program files\python36\lib\site-packages\matp
lotlib\mpl-data\matplotlibrc
DEBUG:matplotlib:matplotlib version 3.0.0
DEBUG:matplotlib:interactive is False
DEBUG:matplotlib:platform is win32
DEBUG:matplotlib:loaded modules: ['builtins', 'sys', '_frozen_importlib', '_imp'
, '_warnings', '_thread', '_weakref', '_frozen_importlib_external', '_io', 'mars
hal', 'nt', 'winreg', 'zipimport', 'encodings', 'codecs', '_codecs', 'encodings.
aliases', 'encodings.utf_8', '_signal', 'encodings.latin_1', 'io', 'abc', '_weak
refset', 'site', 'os', 'errno', 'stat', '_stat', 'ntpath', 'genericpath', 'os.pa
th', '_collections_abc', '_sitebuiltins', 'sysconfig', '_bootlocale', '_locale',
 'encodings.gbk', '_codecs_cn', '_multibytecodec', 'types', 'functools', '_funct
ools', 'collections', 'operator', '_operator', 'keyword', 'heapq', '_heapq', 'it
ertools', 'reprlib', '_collections', 'weakref', 'collections.abc', 'importlib',
'importlib._bootstrap', 'importlib._bootstrap_external', 'warnings', 'importlib.
util', 'importlib.abc', 'importlib.machinery', 'contextlib', 'mpl_toolkits', 'go
ogle', 'ruamel', 'encodings.cp437', 'runpy', 'pkgutil', '__main__', 're', 'enum'
, 'sre_compile', '_sre', 'sre_parse', 'sre_constants', 'copyreg', 'IPython', 'IP
ython.core', 'IPython.core.getipython', 'IPython.core.release', 'IPython.core.ap
plication', 'atexit', 'copy', 'glob', 'fnmatch', 'posixpath', 'logging', 'time',
 'traceback', 'linecache', 'tokenize', 'token', 'string', '_string', 'threading'
, 'shutil', 'zlib', 'bz2', '_compression', '_bz2', 'lzma', '_lzma', 'traitlets',
 'traitlets.traitlets', 'inspect', 'ast', '_ast', 'dis', 'opcode', '_opcode', 's
ix', '__future__', 'struct', '_struct', 'traitlets.utils', 'traitlets.utils.geta
rgspec', 'traitlets.utils.importstring', 'ipython_genutils', 'ipython_genutils._
version', 'ipython_genutils.py3compat', 'ipython_genutils.encoding', 'locale', '
platform', 'subprocess', 'signal', 'msvcrt', '_winapi', 'traitlets.utils.sentine
l', 'traitlets.utils.bunch', 'traitlets._version', 'traitlets.config', 'traitlet
s.config.application', 'json', 'json.decoder', 'json.scanner', '_json', 'json.en
coder', 'decorator', 'traitlets.config.configurable', 'traitlets.config.loader',
 'argparse', 'textwrap', 'gettext', 'ipython_genutils.path', 'random', 'math', '
hashlib', '_hashlib', '_blake2', '_sha3', 'bisect', '_bisect', '_random', 'ipyth
on_genutils.text', 'ipython_genutils.importstring', 'IPython.core.crashhandler',
 'pprint', 'IPython.core.ultratb', 'pydoc', 'urllib', 'urllib.parse', 'IPython.c
ore.debugger', 'bdb', 'IPython.utils', 'IPython.utils.PyColorize', 'IPython.util
s.coloransi', 'IPython.utils.ipstruct', 'IPython.utils.colorable', 'pygments', '
pygments.util', 'IPython.utils.py3compat', 'IPython.utils.encoding', 'IPython.co
re.excolors', 'IPython.testing', 'IPython.testing.skipdoctest', 'pdb', 'cmd', 'c
ode', 'codeop', 'IPython.core.display_trap', 'IPython.utils.path', 'IPython.util
s.process', 'IPython.utils._process_win32', 'ctypes', '_ctypes', 'ctypes._endian
', 'ctypes.wintypes', 'IPython.utils._process_common', 'shlex', 'IPython.utils.d
ecorators', 'IPython.utils.data', 'IPython.utils.terminal', 'IPython.utils.sysin
fo', 'IPython.utils._sysinfo', 'IPython.core.profiledir', 'IPython.paths', 'temp
file', 'IPython.utils.importstring', 'IPython.terminal', 'IPython.terminal.embed
', 'IPython.core.compilerop', 'IPython.core.magic_arguments', 'IPython.core.erro
r', 'IPython.utils.text', 'pathlib', 'IPython.core.magic', 'getopt', 'IPython.co
re.oinspect', 'IPython.core.page', 'IPython.core.display', 'binascii', 'mimetype
s', 'IPython.lib', 'IPython.lib.security', 'getpass', 'IPython.lib.pretty', 'dat
etime', '_datetime', 'IPython.utils.openpy', 'IPython.utils.dir2', 'IPython.util
s.wildcard', 'pygments.lexers', 'pygments.lexers._mapping', 'pygments.modeline',
 'pygments.plugin', 'pygments.lexers.python', 'pygments.lexer', 'pygments.filter
', 'pygments.filters', 'pygments.token', 'pygments.regexopt', 'pygments.unistrin
g', 'pygments.formatters', 'pygments.formatters._mapping', 'pygments.formatters.
html', 'pygments.formatter', 'pygments.styles', 'IPython.core.inputtransformer2'
, 'typing', 'typing.io', 'typing.re', 'IPython.core.interactiveshell', 'asyncio'
, 'selectors', 'select', '_socket', '_overlapped', 'asyncio.base_events', 'concu
rrent', 'concurrent.futures', 'concurrent.futures._base', 'concurrent.futures.pr
ocess', 'queue', 'multiprocessing', 'multiprocessing.context', 'multiprocessing.
process', 'multiprocessing.reduction', 'pickle', '_compat_pickle', '_pickle', 's
ocket', '__mp_main__', 'multiprocessing.connection', '_multiprocessing', 'multip
rocessing.util', 'concurrent.futures.thread', 'asyncio.compat', 'asyncio.corouti
nes', 'asyncio.events', 'asyncio.base_futures', 'asyncio.log', 'asyncio.futures'
, 'asyncio.base_tasks', '_asyncio', 'asyncio.tasks', 'asyncio.locks', 'asyncio.p
rotocols', 'asyncio.queues', 'asyncio.streams', 'asyncio.subprocess', 'asyncio.t
ransports', 'asyncio.windows_events', 'asyncio.base_subprocess', 'asyncio.proact
or_events', 'asyncio.constants', 'asyncio.sslproto', 'ssl', 'ipaddress', '_ssl',
 'base64', 'asyncio.selector_events', 'asyncio.windows_utils', 'pickleshare', 'I
Python.core.prefilter', 'IPython.core.autocall', 'IPython.core.macro', 'IPython.
core.splitinput', 'IPython.core.alias', 'IPython.core.builtin_trap', 'IPython.co
re.events', 'backcall', 'backcall.backcall', 'IPython.core.displayhook', 'IPytho
n.core.displaypub', 'IPython.core.extensions', 'IPython.core.formatters', 'IPyth
on.utils.sentinel', 'IPython.core.history', 'sqlite3', 'sqlite3.dbapi2', '_sqlit
e3', 'IPython.core.logger', 'IPython.core.payload', 'IPython.core.usage', 'IPyth
on.display', 'IPython.lib.display', 'html', 'html.entities', 'IPython.utils.io',
 'IPython.utils.capture', 'IPython.utils.strdispatch', 'IPython.core.hooks', 'IP
ython.utils.syspathcontext', 'IPython.utils.tempdir', 'IPython.utils.contexts',
'IPython.core.async_helpers', 'IPython.terminal.interactiveshell', 'prompt_toolk
it', 'prompt_toolkit.application', 'prompt_toolkit.application.application', 'pr
ompt_toolkit.buffer', 'prompt_toolkit.application.current', 'prompt_toolkit.even
tloop', 'prompt_toolkit.eventloop.base', 'prompt_toolkit.log', 'prompt_toolkit.e
ventloop.coroutine', 'prompt_toolkit.eventloop.defaults', 'prompt_toolkit.utils'
, 'six.moves', 'wcwidth', 'wcwidth.wcwidth', 'wcwidth.table_wide', 'wcwidth.tabl
e_zero', 'prompt_toolkit.cache', 'prompt_toolkit.eventloop.future', 'prompt_tool
kit.eventloop.context', 'prompt_toolkit.eventloop.async_generator', 'six.moves.q
ueue', 'prompt_toolkit.eventloop.event', 'prompt_toolkit.application.run_in_term
inal', 'prompt_toolkit.auto_suggest', 'prompt_toolkit.filters', 'prompt_toolkit.
filters.base', 'prompt_toolkit.filters.app', 'prompt_toolkit.enums', 'prompt_too
lkit.filters.utils', 'prompt_toolkit.filters.cli', 'prompt_toolkit.clipboard', '
prompt_toolkit.clipboard.base', 'prompt_toolkit.selection', 'prompt_toolkit.clip
board.in_memory', 'prompt_toolkit.completion', 'prompt_toolkit.completion.base',
 'prompt_toolkit.completion.filesystem', 'prompt_toolkit.completion.word_complet
er', 'prompt_toolkit.document', 'prompt_toolkit.history', 'prompt_toolkit.search
', 'prompt_toolkit.key_binding', 'prompt_toolkit.key_binding.key_bindings', 'pro
mpt_toolkit.keys', 'prompt_toolkit.key_binding.vi_state', 'prompt_toolkit.valida
tion', 'prompt_toolkit.input', 'prompt_toolkit.input.base', 'prompt_toolkit.inpu
t.defaults', 'prompt_toolkit.input.typeahead', 'prompt_toolkit.key_binding.bindi
ngs', 'prompt_toolkit.key_binding.bindings.page_navigation', 'prompt_toolkit.key
_binding.bindings.scroll', 'prompt_toolkit.key_binding.defaults', 'prompt_toolki
t.key_binding.bindings.basic', 'prompt_toolkit.key_binding.key_processor', 'prom
pt_toolkit.key_binding.bindings.named_commands', 'prompt_toolkit.key_binding.bin
dings.completion', 'prompt_toolkit.key_binding.bindings.emacs', 'prompt_toolkit.
key_binding.bindings.vi', 'prompt_toolkit.input.vt100_parser', 'prompt_toolkit.i
nput.ansi_escape_sequences', 'prompt_toolkit.key_binding.digraphs', 'prompt_tool
kit.key_binding.bindings.mouse', 'prompt_toolkit.layout', 'prompt_toolkit.layout
.containers', 'prompt_toolkit.layout.controls', 'prompt_toolkit.formatted_text',
 'prompt_toolkit.formatted_text.base', 'prompt_toolkit.formatted_text.html', 'xm
l', 'xml.dom', 'xml.dom.domreg', 'xml.dom.minidom', 'xml.dom.minicompat', 'xml.d
om.xmlbuilder', 'xml.dom.NodeFilter', 'prompt_toolkit.formatted_text.ansi', 'pro
mpt_toolkit.output', 'prompt_toolkit.output.base', 'prompt_toolkit.layout.screen
', 'prompt_toolkit.output.defaults', 'prompt_toolkit.output.color_depth', 'promp
t_toolkit.output.vt100', 'prompt_toolkit.styles', 'prompt_toolkit.styles.base',
'prompt_toolkit.styles.defaults', 'prompt_toolkit.styles.style', 'prompt_toolkit
.styles.named_colors', 'prompt_toolkit.styles.pygments', 'prompt_toolkit.styles.
style_transformation', 'colorsys', 'array', 'prompt_toolkit.formatted_text.pygme
nts', 'prompt_toolkit.formatted_text.utils', 'prompt_toolkit.lexers', 'prompt_to
olkit.lexers.base', 'prompt_toolkit.lexers.pygments', 'prompt_toolkit.mouse_even
ts', 'prompt_toolkit.layout.processors', 'prompt_toolkit.layout.utils', 'prompt_
toolkit.layout.dimension', 'prompt_toolkit.layout.margins', 'prompt_toolkit.layo
ut.layout', 'prompt_toolkit.layout.menus', 'prompt_toolkit.renderer', 'prompt_to
olkit.layout.mouse_handlers', 'prompt_toolkit.key_binding.bindings.cpr', 'prompt
_toolkit.key_binding.emacs_state', 'prompt_toolkit.layout.dummy', 'prompt_toolki
t.application.dummy', 'prompt_toolkit.shortcuts', 'prompt_toolkit.shortcuts.dial
ogs', 'prompt_toolkit.key_binding.bindings.focus', 'prompt_toolkit.widgets', 'pr
ompt_toolkit.widgets.base', 'prompt_toolkit.widgets.toolbars', 'prompt_toolkit.w
idgets.dialogs', 'prompt_toolkit.widgets.menus', 'prompt_toolkit.shortcuts.promp
t', 'prompt_toolkit.key_binding.bindings.auto_suggest', 'prompt_toolkit.key_bind
ing.bindings.open_in_editor', 'prompt_toolkit.shortcuts.utils', 'prompt_toolkit.
shortcuts.progress_bar', 'prompt_toolkit.shortcuts.progress_bar.base', 'prompt_t
oolkit.shortcuts.progress_bar.formatters', 'prompt_toolkit.patch_stdout', 'pygme
nts.style', 'IPython.terminal.debugger', 'IPython.core.completer', 'unicodedata'
, 'IPython.core.latex_symbols', 'IPython.utils.generics', 'simplegeneric', 'jedi
', 'jedi.api', 'parso', 'parso.parser', 'parso.tree', 'parso._compatibility', 'p
arso.pgen2', 'parso.pgen2.generator', 'parso.pgen2.grammar_parser', 'parso.pytho
n', 'parso.python.tokenize', 'parso.python.token', 'parso.utils', 'parso.grammar
', 'parso.python.diff', 'difflib', 'parso.python.parser', 'parso.python.tree', '
parso.python.prefix', 'parso.cache', 'gc', 'parso.python.errors', 'parso.normali
zer', 'parso.python.pep8', 'jedi._compatibility', 'jedi.parser_utils', 'jedi.deb
ug', 'jedi.settings', 'jedi.cache', 'jedi.api.classes', 'jedi.evaluate', 'jedi.e
valuate.utils', 'jedi.evaluate.imports', 'jedi.evaluate.sys_path', 'jedi.evaluat
e.cache', 'jedi.evaluate.base_context', 'jedi.common', 'jedi.common.context', 'j
edi.evaluate.helpers', 'jedi.common.utils', 'jedi.evaluate.compiled', 'jedi.eval
uate.compiled.context', 'jedi.evaluate.filters', 'jedi.evaluate.flow_analysis',
'jedi.evaluate.recursion', 'jedi.evaluate.lazy_context', 'jedi.evaluate.compiled
.access', 'jedi.evaluate.compiled.getattr_static', 'jedi.evaluate.compiled.fake'
, 'jedi.evaluate.analysis', 'jedi.evaluate.context', 'jedi.evaluate.context.modu
le', 'jedi.evaluate.context.klass', 'jedi.evaluate.context.function', 'jedi.eval
uate.docstrings', 'jedi.evaluate.pep0484', 'jedi.evaluate.arguments', 'jedi.eval
uate.context.iterable', 'jedi.evaluate.param', 'jedi.evaluate.context.asynchrono
us', 'jedi.evaluate.parser_cache', 'jedi.evaluate.context.instance', 'jedi.evalu
ate.syntax_tree', 'jedi.evaluate.finder', 'jedi.api.keywords', 'pydoc_data', 'py
doc_data.topics', 'jedi.api.interpreter', 'jedi.evaluate.compiled.mixed', 'jedi.
api.helpers', 'jedi.api.completion', 'jedi.api.environment', 'filecmp', 'jedi.ev
aluate.compiled.subprocess', 'jedi.evaluate.compiled.subprocess.functions', 'jed
i.api.exceptions', 'jedi.api.project', 'jedi.evaluate.usages', 'IPython.terminal
.ptutils', 'IPython.terminal.shortcuts', 'IPython.lib.clipboard', 'IPython.termi
nal.magics', 'IPython.terminal.pt_inputhooks', 'IPython.terminal.prompts', 'IPyt
hon.terminal.ipapp', 'IPython.core.magics', 'IPython.core.magics.auto', 'IPython
.core.magics.basic', 'IPython.core.magics.code', 'urllib.request', 'email', 'htt
p', 'http.client', 'email.parser', 'email.feedparser', 'email.errors', 'email._p
olicybase', 'email.header', 'email.quoprimime', 'email.base64mime', 'email.chars
et', 'email.encoders', 'quopri', 'email.utils', 'email._parseaddr', 'calendar',
'email.message', 'uu', 'email._encoded_words', 'email.iterators', 'urllib.error'
, 'urllib.response', 'nturl2path', 'IPython.core.magics.config', 'IPython.core.m
agics.display', 'IPython.core.magics.execution', 'timeit', 'cProfile', '_lsprof'
, 'profile', 'optparse', 'pstats', 'IPython.utils.module_paths', 'IPython.utils.
timing', 'IPython.core.magics.extension', 'IPython.core.magics.history', 'IPytho
n.core.magics.logging', 'IPython.core.magics.namespace', 'IPython.core.magics.os
m', 'IPython.core.magics.pylab', 'IPython.core.pylabtools', 'IPython.core.magics
.script', 'IPython.lib.backgroundjobs', 'IPython.core.shellapp', 'IPython.extens
ions', 'IPython.extensions.storemagic', 'IPython.utils.frame', 'IPython.core.com
pleterlib', 'colorama', 'colorama.initialise', 'colorama.ansitowin32', 'colorama
.ansi', 'colorama.winterm', 'colorama.win32', 'pygments.styles.default', 'pygmen
ts.lexers.shell', 'pygments.lexers.html', 'pygments.lexers.javascript', 'pygment
s.lexers.jvm', 'pygments.lexers.css', 'pygments.lexers.ruby', 'pygments.lexers.p
erl', 'pygments.lexers.markup', 'prompt_toolkit.output.conemu', 'prompt_toolkit.
output.win32', 'prompt_toolkit.win32_types', 'prompt_toolkit.output.windows10',
'prompt_toolkit.input.win32', 'prompt_toolkit.eventloop.win32', 'prompt_toolkit.
eventloop.inputhook', 'prompt_toolkit.eventloop.select', 'prompt_toolkit.eventlo
op.utils', 'prompt_toolkit.key_binding.bindings.search', 'storemagic', 'weka', '
weka.core', 'scipy', 'numpy', 'numpy._globals', 'numpy.__config__', 'numpy.versi
on', 'numpy._import_tools', 'numpy.add_newdocs', 'numpy.lib', 'numpy.lib.info',
'numpy.lib.type_check', 'numpy.core', 'numpy.core.info', 'numpy.core.multiarray'
, 'numpy.core.umath', 'numpy.core._internal', 'numpy.compat', 'numpy.compat._ins
pect', 'numpy.compat.py3k', 'numpy.core.numerictypes', 'numbers', 'numpy.core.nu
meric', 'numpy.core.fromnumeric', 'numpy.core._methods', 'numpy.core.arrayprint'
, 'numpy.core.defchararray', 'numpy.core.records', 'numpy.core.memmap', 'numpy.c
ore.function_base', 'numpy.core.machar', 'numpy.core.getlimits', 'numpy.core.sha
pe_base', 'numpy.core.einsumfunc', 'numpy.testing', 'unittest', 'unittest.result
', 'unittest.util', 'unittest.case', 'unittest.suite', 'unittest.loader', 'unitt
est.main', 'unittest.runner', 'unittest.signals', 'numpy.testing._private', 'num
py.testing._private.utils', 'numpy.lib.utils', 'numpy.testing._private.decorator
s', 'numpy.testing._private.nosetester', 'numpy.testing._private.pytesttester',
'numpy.lib.ufunclike', 'numpy.lib.index_tricks', 'numpy.lib.function_base', 'num
py.lib.twodim_base', 'numpy.lib.histograms', 'numpy.matrixlib', 'numpy.matrixlib
.defmatrix', 'numpy.linalg', 'numpy.linalg.info', 'numpy.linalg.linalg', 'numpy.
linalg.lapack_lite', 'numpy.linalg._umath_linalg', 'numpy.lib.stride_tricks', 'n
umpy.lib.mixins', 'numpy.lib.nanfunctions', 'numpy.lib.shape_base', 'numpy.lib.s
cimath', 'numpy.lib.polynomial', 'numpy.lib.arraysetops', 'numpy.lib.npyio', 'nu
mpy.lib.format', 'numpy.lib._datasource', 'numpy.lib._iotools', 'numpy.lib.finan
cial', 'decimal', '_decimal', 'numpy.lib.arrayterator', 'numpy.lib.arraypad', 'n
umpy.lib._version', 'numpy.core._multiarray_tests', 'numpy._distributor_init', '
numpy.fft', 'numpy.fft.info', 'numpy.fft.fftpack', 'numpy.fft.fftpack_lite', 'nu
mpy.fft.helper', 'numpy.polynomial', 'numpy.polynomial.polynomial', 'numpy.polyn
omial.polyutils', 'numpy.polynomial._polybase', 'numpy.polynomial.chebyshev', 'n
umpy.polynomial.legendre', 'numpy.polynomial.hermite', 'numpy.polynomial.hermite
_e', 'numpy.polynomial.laguerre', 'numpy.random', 'numpy.random.info', 'cython_r
untime', 'mtrand', 'numpy.random.mtrand', 'numpy.ctypeslib', 'numpy.ma', 'numpy.
ma.core', 'numpy.ma.extras', 'scipy._distributor_init', 'scipy.__config__', 'sci
py.version', 'scipy._lib', 'scipy._lib._testutils', 'scipy._lib._version', 'scip
y._lib.six', 'scipy._lib._ccallback', 'scipy._lib._ccallback_c', 'weka.core.jvm'
, 'javabridge', 'javabridge.jutil', 'uuid', 'ctypes.util', 'javabridge.locate',
'_javabridge', 'javabridge._javabridge', 'javabridge.wrappers', 'matplotlib', 'd
istutils', 'distutils.version', 'matplotlib.cbook', 'gzip', 'matplotlib.cbook.de
precation', 'matplotlib.rcsetup', 'matplotlib.fontconfig_pattern', 'pyparsing',
'matplotlib.colors', 'matplotlib._color_data', 'cycler', 'matplotlib._version',
'dateutil', 'dateutil._version']

Example from documentation "Create dataset from matrices" raises an exception

Sorry, failure on my part to start the VM!

The example I'm following is: http://fracpete.github.io/python-weka-wrapper/examples.html#create-dataset-from-matrices

My library versions are:
python-weka-wrapper3 0.2.3
numpy 1.21.1
javabridge 1.0.19

Python 3.9.6 (default, Jul 26 2021, 11:20:45)
[GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import numpy as np
from weka.core.dataset import create_instances_from_matrices

x = np.random.randn(10, 5)
y = np.random.randn(10)
dataset = create_instances_from_matrices(x, y, name="generated from matrices")

Traceback (most recent call last):
File "/home/danny/Envs/wtest/lib/python3.9/site-packages/weka/core/dataset.py", line 1693, in create_instances_from_matrices
if np.issubdtype(x.dtype[i], np.number):
KeyError: 'There are no fields in dtype float64.'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "/home/danny/Envs/wtest/lib/python3.9/site-packages/weka/core/dataset.py", line 1704, in create_instances_from_matrices
atts.append(Attribute.create_numeric("x" + str(i+1)))
File "/home/danny/Envs/wtest/lib/python3.9/site-packages/weka/core/dataset.py", line 1244, in create_numeric
javabridge.make_instance(
File "/home/danny/Envs/wtest/lib/python3.9/site-packages/javabridge/jutil.py", line 1717, in make_instance
klass = get_env().find_class(class_name)
AttributeError: 'NoneType' object has no attribute 'find_class'

Installed packages raise "TypeError: Argument 'o' has incorrect type"

I have tried to replicate the example in this presentation https://www.cs.waikato.ac.nz/~eibe/WEKA_Ecosystem.pdf on Win 10/python 3.6

My code is:
import weka.core.packages as packages
from weka.clusterers import Clusterer
packages.install_package("CLOPE")
'>>>True
cl = Clusterer("weka.clusterers.CLOPE")

I get the following error:
File "", line 1, in
cl = Clusterer("weka.clusterers.CLOPE")
File "C:\Users\plami\Anaconda3\lib\site-packages\weka\clusterers.py", line 52, in init
self.is_updateable = self.check_type(jobject, "weka.clusterers.UpdateableClusterer")
File "C:\Users\plami\Anaconda3\lib\site-packages\weka\core\classes.py", line 618, in check_type
return is_instance_of(jobject, intf_or_class)
File "C:\Users\plami\Anaconda3\lib\site-packages\weka\core\classes.py", line 122, in is_instance_of
if is_array(obj):
File "C:\Users\plami\Anaconda3\lib\site-packages\weka\core\classes.py", line 146, in is_array
cls = javabridge.call(obj, "getClass", "()Ljava/lang/Class;")
File "C:\Users\plami\Anaconda3\lib\site-packages\javabridge\jutil.py", line 883, in call
fn = make_call(o, method_name, sig)
File "C:\Users\plami\Anaconda3\lib\site-packages\javabridge\jutil.py", line 831, in make_call
assert o is not None
AssertionError

How to use pyinstaller with weka?

Hi, I need some help.
I am converting my python code to executable files with pyinstaller.
I encountered the error, as follows. I know nothing about java.... Packaged java environment not found?
image

_find_mac_lib() throws exception

DEBUG:javabridge.jutil:Creating JVM object
DEBUG:javabridge.jutil:Launching VM in non-python thread
ERROR:javabridge.jutil:Failed to execute "find" when searching for libjvm
Traceback (most recent call last):
File "/Users/jansp/virtualenv/xxxxx-poc/lib/python3.5/site-packages/javabridge/jutil.py", line 116, in _find_mac_lib
lines = result.split("\n")
TypeError: a bytes-like object is required, not 'str'

A fix might be to add .decode() to line 115 and .encode() to line 119

Add convenience methods to make subset generation of datasets easier

The following methods use the Remove filter under the hood to generate the subset

  • add subset_by_colname() method to Instances class (uses names of attributes)
  • add subset_by_colindex() method to Instances class (uses indices of attributes, 0- or 1-based)
    The following method uses the RemoveRange filter under the hood:
  • add subset_by_rowindex() method to Instances classes (uses indices of rows, 0- or 1-based)

AttributeError: 'NoneType' object has no attribute 'find_class'

When i'm trying to load a file using Loader class or load_any_file function. I'm getting this error AttributeError: 'NoneType' object has no attribute 'find_class'

how to solve this issue

my code

# load a dataset


def foo(data1):
    #loader = Loader(classname="weka.core.converters.ArffLoader")
    data = load_any_file(data1)
    data.class_is_last()
    remove = Filter(classname="weka.filters.unsupervised.instance.imagefilter.FCTHFilter")
    remove.inputformat(data)
    filtered = remove.filter(data)
    file_path = "/dbfs/FileStore/tables/pids/{}/{}/02_image_fcth_features_{}".format(PID,DATE,k)
    with open(file_path,"w") as fh:
      fh.write("\n".join(filtered.copy_structure()))
    return None
  
def main():
  data1 = "/dbfs/FileStore/tables/pids/{}/{}/01_image_file_names_".format(PID,DATE)
  data2 = data1 + "*.arff"
  jpgs = glob.glob(data2)
  start = time.time()
  pool = Pool(processes=multiprocessing.cpu_count())
  hits = pool.starmap(foo, zip(jpgs,loader))
  end = time.time()
  print(f"Execution time: {end - start} seconds.")
  
if __name__ == "__main__":
  main()

This is the error

AttributeError                            Traceback (most recent call last)
<command-166581397211145> in <module>
     38 
     39 if __name__ == "__main__":
---> 40   main()

<command-166581397211145> in main()
     32   start = time.time()
     33   pool = Pool(processes=multiprocessing.cpu_count())
---> 34   hits = pool.map(foo, jpgs)
     35   end = time.time()
     36   print(hits)

/usr/lib/python3.7/multiprocessing/pool.py in map(self, func, iterable, chunksize)
    266         in a list that is returned.
    267         '''
--> 268         return self._map_async(func, iterable, mapstar, chunksize).get()
    269 
    270     def starmap(self, func, iterable, chunksize=None):

/usr/lib/python3.7/multiprocessing/pool.py in get(self, timeout)
    655             return self._value
    656         else:
--> 657             raise self._value
    658 
    659     def _set(self, i, obj):

/usr/lib/python3.7/multiprocessing/pool.py in worker(inqueue, outqueue, initializer, initargs, maxtasks, wrap_exception)
    119         job, i, func, args, kwds = task
    120         try:
--> 121             result = (True, func(*args, **kwds))
    122         except Exception as e:
    123             if wrap_exception and func is not _helper_reraises_exception:

/usr/lib/python3.7/multiprocessing/pool.py in mapstar(args)
     42 
     43 def mapstar(args):
---> 44     return list(map(*args))
     45 
     46 def starmapstar(args):

<command-166581397211145> in foo(data1)
     12   print(data1)
     13 #     loader = Loader(classname="weka.core.converters.ArffLoader")
---> 14   data = load_any_file(data1)
     15   data.class_is_last()
     16   remove = Filter(classname="weka.filters.unsupervised.instance.imagefilter.FCTHFilter")

/databricks/python/lib/python3.7/site-packages/weka/core/converters.py in load_any_file(filename, class_index)
    273     :rtype: Instances
    274     """
--> 275     loader = loader_for_file(filename)
    276     if loader is None:
    277         return None

/databricks/python/lib/python3.7/site-packages/weka/core/converters.py in loader_for_file(filename)
    255     loader = javabridge.static_call(
    256         "weka/core/converters/ConverterUtils", "getLoaderForFile",
--> 257         "(Ljava/lang/String;)Lweka/core/converters/AbstractFileLoader;", filename)
    258     if loader is None:
    259         return None

/databricks/python/lib/python3.7/site-packages/javabridge/jutil.py in static_call(class_name, method_name, sig, *args)
    937     '''
    938     env = get_env()
--> 939     fn = make_static_call(class_name, method_name, sig)
    940     args_sig = split_sig(sig[1:sig.find(')')])
    941     ret_sig = sig[sig.find(')')+1:]

/databricks/python/lib/python3.7/site-packages/javabridge/jutil.py in make_static_call(class_name, method_name, sig)
    908     '''
    909     env = get_env()
--> 910     klass = env.find_class(class_name)
    911     if klass is None:
    912         jexception = get_env().exception_occurred()

AttributeError: 'NoneType' object has no attribute 'find_class'

How to set the weight?

I'm trying to set the weight for an instance using
inst.weight(0.1) but I receive the following error

Screen Shot 2019-10-25 at 1 25 34 PM

I can print the weight with inst.weight

Could you please help me with that?

need help with java heap space

def main():
    loader = Loader(classname="weka.core.converters.ArffLoader")
    saved_file = "..\\resource\\saved2.arff"
    data = loader.load_file(saved_file)
    data.class_is_first()
    train, test = data.train_test_split(66.0, Random(1))
    classifier = Classifier(classname="weka.classifiers.bayes.BayesNet",
                            options=["-D", "-Q", "weka.classifiers.bayes.net.search.local.K2",
                                     "-E", "weka.classifiers.bayes.net.estimate.SimpleEstimator"])
    classifier.build_classifier(train)
    evaluation = Evaluation(train)
    evaluation.test_model(classifier, test)
    print(evaluation.summary())
    print("pctCorrect: " + str(evaluation.percent_correct))
    print("incorrect: " + str(evaluation.incorrect))
    print(evaluation.matrix())


if __name__ == "__main__":
    try:
        os.environ["_JAVA_OPTIONS"] = "-Xms128m -Xmx24576m -Dfile.encoding=UTF-8"
        jvm.start(packages=True,max_heap_size="24576m")
        main()
    except Exception as e:
        print(e.__str__())
    finally:
        jvm.stop()
C:\Users\zgl\AppData\Local\Programs\Python\Python37\python.exe C:/Users/zgl/PycharmProjects/weka-program-master/code/WekaTextCategorization.py
DEBUG:weka.core.jvm:Adding bundled jars
DEBUG:weka.core.jvm:Classpath=['C:\\Users\\zgl\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\javabridge\\jars\\rhino-1.7R4.jar', 'C:\\Users\\zgl\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\javabridge\\jars\\runnablequeue.jar', 'C:\\Users\\zgl\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\javabridge\\jars\\cpython.jar', 'C:\\Users\\zgl\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\weka\\lib\\python-weka-wrapper.jar', 'C:\\Users\\zgl\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-packages\\weka\\lib\\weka.jar']
DEBUG:weka.core.jvm:MaxHeapSize=24576m
DEBUG:weka.core.jvm:Package support enabled
java.lang.OutOfMemoryError: Java heap space
	weka.classifiers.bayes.net.ParentSet.(ParentSet.java:135)
	weka.classifiers.bayes.BayesNet.initStructure(BayesNet.java:325)
	weka.classifiers.bayes.BayesNet.buildClassifier(BayesNet.java:224)

	at weka.classifiers.bayes.net.ParentSet.(ParentSet.java:135)
	at weka.classifiers.bayes.BayesNet.initStructure(BayesNet.java:325)
	at weka.classifiers.bayes.BayesNet.buildClassifier(BayesNet.java:224)
Java heap space
Picked up _JAVA_OPTIONS: -Xms128m -Xmx24576m -Dfile.encoding=UTF-8
Exception in thread "Thread-0" 
Process finished with exit code 0

I changed java heap space with max_heap_size="24576m" and it seems worked,but after 8-9 hours running it still warning Java heap space Exception.
Maybe it's a problem of Memory Leak.
Or i wrote wrong code?
Can you help me?

Unable to use python-weka-wrapper on macos

Following is the error I am getting
I am unsure of what package file to use .
Link given to variable "packages" is from Weka application wekafiles
I am getting this error while running it in PyCharm

jvm.start(system_cp=True, packages='/Users/addy93/wekafiles/packages')
DEBUG:weka.core.jvm:Adding bundled jars
DEBUG:weka.core.jvm:Adding system classpath
DEBUG:weka.core.jvm:Classpath=['/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/javabridge/jars/rhino-1.7R4.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/javabridge/jars/runnablequeue.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/javabridge/jars/cpython.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Applications/weka-3-8-0/weka.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Applications/weka-3-8-0/weka.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Applications/weka-3-8-0/weka.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Applications/weka-3-8-0/weka.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Applications/weka-3-8-0/weka.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar', '/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/lib/python-weka-wrapper.jar']
DEBUG:weka.core.jvm:MaxHeapSize=default
DEBUG:weka.core.jvm:Using alternative Weka home directory: /Users/addy93/wekafiles/packages
Failed to get class Lweka/core/Environment;
Exception in thread "Thread-21" java.lang.NoClassDefFoundError: Lweka/core/Environment;
Caused by: java.lang.ClassNotFoundException: weka.core.Environment
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Traceback (most recent call last):
File "", line 1, in
File "/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/core/jvm.py", line 114, in start
env = Environment.system_wide()
File "/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/weka/core/classes.py", line 729, in system_wide
"Lweka/core/Environment;", "getSystemWide", "()Lweka/core/Environment;"))
File "/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/javabridge/jutil.py", line 934, in static_call
fn = make_static_call(class_name, method_name, sig)
File "/Users/addy93/PycharmProjects/Test/venv/lib/python3.6/site-packages/javabridge/jutil.py", line 908, in make_static_call
raise JavaException(jexception)
javabridge.jutil.JavaException: Lweka/core/Environment;

add entry_point for package manager

  • add entry_point pww-packages that points to weka.core.packages
  • add argument parsing with following sub-commands
    • list --type installed|available|all - lists packages
    • info [--name NAME] - outputs info on all or just one particular package
    • install --name NAME/URL/PATH [--version VERSION] - installs the specified package
    • uninstall --name NAME - uninstalls the specified package
    • suggest --class CLASSNAME - suggest package(s) that contain the specified class
    • is-installed --name NAME - outputs true|false when package is installed or not

AttributeError: 'Instance' object has no attribute 'encode'

for simple code :

tree.build_classifier(labledDataSet)
eval = Evaluation(labledDataSet)
eval.evaluate_model(tree, test)

i got this error :

DEBUG:weka.core.jvm:MaxHeapSize=default
DEBUG:weka.core.jvm:Package support enabled
Picked up _JAVA_OPTIONS: -Dfile.encoding=UTF-8
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by weka.core.WekaPackageClassLoaderManager (file:/home/farzad/anaconda3/envs/mix/lib/python3.5/site-packages/weka/lib/weka.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of weka.core.WekaPackageClassLoaderManager
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Traceback (most recent call last):
  File "main.py", line 187, in <module>
    raise e
  File "main.py", line 165, in <module>
    eval.evaluate_model(tree, test)
  File "/home/farzad/anaconda3/envs/mix/lib/python3.5/site-packages/weka/classifiers.py", line 1942, in evaluate_model
    classifier.jobject, args)
  File "/home/farzad/anaconda3/envs/mix/lib/python3.5/site-packages/javabridge/jutil.py", line 937, in static_call
    nice_args = get_nice_args(args, args_sig)
  File "/home/farzad/anaconda3/envs/mix/lib/python3.5/site-packages/javabridge/jutil.py", line 1144, in get_nice_args
    for arg, subsig in zip(args, sig)]
  File "/home/farzad/anaconda3/envs/mix/lib/python3.5/site-packages/javabridge/jutil.py", line 1144, in <listcomp>
    for arg, subsig in zip(args, sig)]
  File "/home/farzad/anaconda3/envs/mix/lib/python3.5/site-packages/javabridge/jutil.py", line 1211, in get_nice_arg
    objs = [get_nice_arg(subarg, sig[1:]) for subarg in arg]
  File "/home/farzad/anaconda3/envs/mix/lib/python3.5/site-packages/javabridge/jutil.py", line 1211, in <listcomp>
    objs = [get_nice_arg(subarg, sig[1:]) for subarg in arg]
  File "/home/farzad/anaconda3/envs/mix/lib/python3.5/site-packages/javabridge/jutil.py", line 1179, in get_nice_arg
    return env.new_string_utf(arg)
  File "_javabridge.pyx", line 1662, in _javabridge.JB_Env.new_string_utf
AttributeError: 'Instance' object has no attribute 'encode'

Learning curve for multiple tests sets

Upgrade method plot_learning_curve in module weka.plot.classifierers to handle a list of tests sets. This will allow plotting of curves for train and test set in the same plot.

Common issue found while pip3 installing python-weka-wrapper3

Collecting python-weka-wrapper3
  Downloading https://files.pythonhosted.org/packages/48/3a/0f345b19774b5b6c53e9456c2985d79ff09b610bbf29d95403004734a45b/python-weka-wrapper3-0.1.7.tar.gz (10.1MB)
     |████████████████████████████████| 10.1MB 22.0MB/s 
Collecting javabridge>=1.0.14 (from python-weka-wrapper3)
  Downloading https://files.pythonhosted.org/packages/a6/a0/c59bccabed99b1d4ac68166c59c679b375bfca75b78688b52c541b711578/javabridge-1.0.18.tar.gz (1.3MB)
     |████████████████████████████████| 1.3MB 22.1MB/s 
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-_s3z91hy/javabridge/

Many of my friends and I are facing this issue while installing python-weka-wrapper3 for a project

Add wrapper for AssociationRulesProducer

  • add wrapper for weka.assocations.AssociationRulesProducer
  • add wrappers for subsequent methods as well
    • weka.assocations.AssociationRules
    • weka.assocations.AssociationRule
    • weka.assocations.Item

Error installing Weka packages on Docker

Hi,

I've pulled and executed the docker CPU 0.2.14_cpu. I'm trying to run a .py file where commands to install Weka packages are included. Inside the .py I have this header and install commands.

import os
import sys

sys.path
sys.path.append("/usr/lib/jvm/java-11-openjdk-amd64/bin/")
os.environ["JAVA_HOME"] = "/usr/lib/jvm/java-11-openjdk-amd64/"

import weka.core.jvm as jvm
from weka.core.converters import Loader
from weka.classifiers import Classifier
from weka.timeseries import WekaForecaster
from weka.core.dataset import Instances
from javabridge import JWrapper
import weka.core.packages as packages
from weka.filters import Filter

jvm.start(packages=True)
packages.install_package("timeseriesForecasting")
packages.install_package("alternatingModelTrees")

loader = Loader("weka.core.converters.ArffLoader")

However, I got the attached error.
error.txt

Accessing statistics of support and confidence for rule classifiers defined in weka.classifiers.rules

Hey @fracpete ,

I am working on the rule generation methods OneR, PRISM, JRIP, PART, Decision list and others available in Weka using python-weka-wrapper. I want to get the basic statistics like coverage, confidence, true positive etc. of the generated rules. I got the rules as a string using toString() method on the Classifier object.

I was trying to use the RuleStats class defined in Weka for this but unable to figure out how to use it. So, can you help me with using RuleStat or suggest a way to get the ruleset for all the rule generation methods and the statistics for each rule?

Any help in this regard will be highly appreciated.

Error when I try to use loader to load arff file with utf-8 characters

Dear Developer:
English is not my mother tongue.
please excuse any errors on this issue.
I'm new to Weka.
I have made a fomatted arff file. And it just works fine when i load it in Weka Gui. (I have edited RunWeka.ini with fileEncoding=UTF-8)
I use this dataset for text classification and this dataset performs well when i do percentage split classsify with BayesNet Classifier. result.txt
But when i use python-weka-wrapper3:

import weka.core.jvm as jvm
jvm.start()
DEBUG:weka.core.jvm:Adding bundled jars
DEBUG:weka.core.jvm:Classpath=['D:\Python\lib\site-packages\javabridge\jars\rhino-1.7R4.jar', 'D:\Python\lib\site-packages\javabridge\jars\runnablequeue.jar', 'D:\Python\lib\site-packages\javabridge\jars\cpython.jar', 'D:\Python\lib\site-packages\weka\lib\python-weka-wrapper.jar', 'D:\Python\lib\site-packages\weka\lib\weka.jar']DEBUG:weka.core.jvm:MaxHeapSize=default
DEBUG:weka.core.jvm:Package support disabled
from weka.core.converters import Loader, Saver
loader = Loader(classname="weka.core.converters.ArffLoader")
data = loader.load_file("D:\Cutwords\TrainingDocuments_Preprocessed.arff")
Exception in thread "Thread-0" java.io.IOException: Unable to determine structure as arff (Reason: java.lang.IllegalArgumentException: Attribute names are not unique! Causes: '涓?涓?' '涓?浜?' '涓?鍙?' '涓?鍙?' '涓?搴?' '涓?' '涓?' '涔?' '浜?' '浜?' '浜?' '浼?' '浣?' '浣?' '鍏?' '鍐?' '鍐?' '鍓?' '鍙?' '鍙?' '鍙?' '鍙?' '鍙?' '鍚?' '鍚?' '鍚?' '鍚?' '鍠?' '鍥?' '澧?' '澶?' '澶?' '澶?' '澶?' '濂?' '瀛?' '瀛?' '瀹?' '灏?' '灞?' '甯?' '骞?' '寮?' '寮?' '寰?' '蹇?' '蹇?' '鎯?' '鎯?' '鎴?' '鎸?' '鎺?' '鏂?' '鏃?' '鏃?' '鏄?' '鏄?' '鏇?' '鏈?' '鏉?' '姝?' '姹?' '娉?' '娓?' '鐗?' '鐢?' '鐢?' '鐢?' '鐪?' '鐪?' '鐪?' '鐭?' '鐭?' '绉?' '绉?' '缁?' '缁?' '鑳?' '鑸?' '瑙?' '璁?' '璇?' '璇?' '璇?' '璇?' '璇?' '璇?' '璧?' '璧?' '杩?' '杩?' '杩?' '閫?' '閫?' '闆?' '闆?' '闈?' '椋?' '椋?' ' 棣?' '涓?' '浜?' '浜?' '浠?' '鍒?' '鍓?' '鍗?' '鍗?' '鍙?' '鍚?' '鍚?' '鍝?' '鍠?' '鍥?' '澶?' '濞?' '灞?' '宸?' '甯?' '甯?' '骞?' '寮?' '寮?' '鎬?' '鎬?' '鎯?' '鎯?' '鎰?' '鎴?' '鎵?' '鎵?' '鎵?' '鎶?' '鎷?' '鎸?' '鎹?' '鎺?' '鎼?' '鎼?' '鎾?' '鎾?' '鎾?' '鏁?' '鏂?' '鏄?' '鏄?' '鏄?' '鏅?' '鏇?' '鏈?' '鏉?' '鏉?' '姝?' '姘?' '姹?' '娣?' '娓?' '鐑?' '鐖?' '鐙?' '鐜?' '鐞?' '鐞?' '鐢?' '鐢?' '鐢?' '绉?' '绔?' '绾?' '鑳?' '鑴?' '鑵?' '鑼?' '鑾?' '琛?' '瓒?' '璺?' '閫?' '閬?' '閮?' '閿?' '闆?' '闆?' '楠?' '涓?浠?' '涓?骞?' '涓?' '涓?' '涔?' '鍋?' '鍏?' '鍐?' '鍒?' '鍔?' '鍗?' '鍗?' '鍙?' '鍙?' '鍝?' '鍥?' '鍧?' '澶?' '寮?' '寰?' '鎬?' '鎭?' '鎭?' ' 鎴?' '鎵?' '鎶?' '鎺?' '鏀?' '鏉?' '鏉?' '娆?' '娓?' '鐞?' '鐨?' '鐮?' '绔?' '绛?' '缁?' '缃?' '鑳?' '璇?' '璧?' '璧?' '璧?' '瓒?' '杩?' '杩?' '閲?' '闃?' '闇?' '涓?' '涔?' '浜?' '浜?' '浣?' '鍏?' '鍏?' '鍑?' '鍑?' '鍔?' '鍙?' '鍧?' '濡?' '瀛?' '瀹?' '瀹?' '甯?' '寮?' '鎬?' '鎶?' '鏈?' '娌?' '鐐?' '绾?' '缃?' '鑲?' '璋?' '璐?' '璧?' '璺?' '韪?' '杞?' '杞?' '杈?' '閫?' '閫?' '閫?' '閾?' '閾?' '闄?' '涓?缁?' '浜?' '浠?' '浠?' '浼?' '淇?' '鍊?' '鍊?' '鍏?' '鍗?' '鍗?' '濂?' '瀹?' '瀹?' '灞?' '甯?' '骞?' '搴?' '鎬?' '鎴?' '鎴?' '鎵?' '鎷?' '鏀?' '鏀?' '鏈?浣?' '鏍?' '娆?' '婀?' '鐜?' '鐩?' '绉?' '绋?' '璇?' '璐?' '閲?' '闄?' '闄?' '涓?鍙?' '淇?' '鍋?' '鍏?' '鍒?' '鍗?' '鍙?' '鍞?' '鍞?' '鍧?' '瀹?' '搴?' '搴?' '鎵?' '鎷?' '鎷?' '鎸?' '鏉?' '姣?' '娌?' '鐗?' '鐢?' '绾?' '绾?' '鑰?' '瑁?' '璐?' '璐?' '杞?' '杈?' '閫?' '閫?' '閰?' '闂?' '椹?' '楂橀??' '涓?涓?' '涓?浠?' '涓?澶?' '涓?鎵?' '涓?鎵?' '涓?绾?' '鍏?' '鍏?' '鍗?' '澶?' '瀛?' '鎷?' '鎽?' '鏃?' '绫?' '缇?' '鑳?' '璇?' '璧?' '闀?' '涓?鏂?' '鍒?' '灞?' '蹇??' '鎵?' '鎼?' '鏃?' '鏈?' '鐗?' '鐮?' '绁?' '韬?' '閬?' '閽?' '閿?' '楂橀??' '涓?鏋?' '涓?鏋?' '浠?' '浣?' '淇?' '鍐?' '鍖?' '鍙?' '鍙?' '鍚?' '灞?' '宸?' '宸?' '甯?' '鎵?' '鎸?' '鎺?' '鏋?' '鏋?' '鏋?' '鏍?' '姝?' '鐐?' '鐩?' '鐮?' '鑸?' '鑸?' '鑻?' '杞?' '杩?' '閫?浼?' '椹?' '涓?澶?' '涔?' '浜?' '浠?' '浼?' '鍏?' '鍘?' '鍠?' '鍥?' '澶?' '澶?' '瀵?' '宀?' '鎱?' '鎽?' '鎽?' '鏃?' '鏈?鍏?' '妗?' '娌?' '娲?' '鐖?' ' 鑺?' '璋?' '璧?' '璧?' '閫?' '闀?' '闂?' '浼?' '浼?' '鍊?' '鍒?' '鍒?' '鍓?' '鍗?' '鍩?' '澶ч??' '濞?' '姊?' '鑻?' '闊?' '涓?澶?' '涓?灞?' '涓?鎴?' '浜?' '淇?' '淇?' '鍏?' '鍔?' '鍦?' '鍧?' '蹇?' '鎸?' '鎹?' '鎼?' '鏋?' '鏍?' '鏍?' '娌?' '鐏?' '绌?' '缇?' '鑲?' '鑲?' '鑻?' '鑽?' '鑿?' '棰?' '椋?' '楗?' '椹?' '楦?' '榛?' '涓?绉?' '涔?' '浠?' '鍑?' '鍓?' '鍓?' '鍖?' '鍗?' '鍦?' '甯?' '搴?' '鎬?' '鎶?' '鏈?' '姘?' '娴?' '鐐?' '鐙?' '鐙?' '鐜?' '鐮?' '璺?' '閲?' '閾?' '椴?' '涓?涓?' '涓?浜?' '涓?鍗?' '涓?鍛?' '涓?鐪?' '涓?琚?' '涓?椤?' '鍋?' '鍑?' '鍙?' '鍛?' '鍜?' '鍠?' '濡?' '濡?' '濞?' '濞?' '瀚?' '瀚?' '瀹?' '瀵?' '寮?鍙?' '蹇?' '鎬?' '鎭?' '鎰?' '鎵?' '鎷?' '鎺?' '鏁?' '鏂?' '鏃?' '鏅?' '姣?' '娲?' '婊?' '鐖?' '鐖?' '鐢?' '鐣?' '鐪?' '绾?' '琛?' '璐?' '瓒?' '璺?' '闂?' '闈?' '楠?' ).
at weka.core.converters.ArffLoader.getStructure(ArffLoader.java:1251)
at weka.core.converters.ArffLoader.getDataSet(ArffLoader.java:1280)
Traceback (most recent call last):
File "", line 1, in
File "D:\Python\lib\site-packages\weka\core\converters.py", line 88, in load_file
return Instances(javabridge.call(self.jobject, "getDataSet", "()Lweka/core/Instances;"))
File "D:\Python\lib\site-packages\javabridge\jutil.py", line 887, in call
result = fn(*nice_args)
File "D:\Python\lib\site-packages\javabridge\jutil.py", line 854, in fn
raise JavaException(x)
javabridge.jutil.JavaException: Unable to determine structure as arff (Reason: java.lang.IllegalArgumentException: Attribute names are not unique! Causes: '涓�涓�' '涓�浜�' '涓�鍙�' '涓�鍙�' '涓�搴�' '涓�' '涓�' '涔�' '浜�' '浜�' '浜�' '浼�' '浣�' '浣�' '鍏�' '鍐�' '鍐�' '鍓�' '鍙�' '鍙�' '鍙�' '鍙�' '鍙�' '鍚�' '鍚�' '鍚�' '鍚�' '鍠�' '鍥�' '澧�' '澶�' '澶�' '澶�' '澶�' '濂�' '瀛�' '瀛�' '瀹�' '灏�' '灞�' '甯�' '骞�' '寮�' '寮�' '寰�' '蹇�' '蹇�'

It seems to be a problem of file encoding.
And i tried to find how to change fileEncoding in python-weka-wrapper3Docs and haven't find yet.
Here is the dataset TrainingDocuments_Preprocessed.arff
And this is stop-words file stopwordsFile
Can you help me?

Plot multiple graphs

How to display plot_roc and plot_classifier_errors at the same time?
I realize I have to close another window of matplot for the program to pop up another window for another program by using the weak. plot.classifiers

java exception

PC configuration :Os windows 10, Python 3.10,Last version of python-weka-wrapper3

After

jvm.start(packages=True)

I get:

DEBUG:weka.core.jvm:Adding bundled jars
DEBUG:weka.core.jvm:Classpath=['C:\Users\utente\AppData\Local\anaconda3\Lib\site-packages\javabridge\jars\rhino-1.7R4.jar', 'C:\Users\utente\AppData\Local\anaconda3\Lib\site-packages\javabridge\jars\runnablequeue.jar', 'C:\Users\utente\AppData\Local\anaconda3\Lib\site-packages\javabridge\jars\cpython.jar', 'C:\Users\utente\AppData\Local\anaconda3\lib\site-packages\weka\lib\arpack_combined.jar', 'C:\Users\utente\AppData\Local\anaconda3\lib\site-packages\weka\lib\core.jar', 'C:\Users\utente\AppData\Local\anaconda3\lib\site-packages\weka\lib\mtj.jar', 'C:\Users\utente\AppData\Local\anaconda3\lib\site-packages\weka\lib\python-weka-wrapper.jar', 'C:\Users\utente\AppData\Local\anaconda3\lib\site-packages\weka\lib\weka.jar']
DEBUG:weka.core.jvm:MaxHeapSize=default
DEBUG:weka.core.jvm:Package support enabled
giu 28, 2023 12:07:11 PM com.github.fommil.netlib.ARPACK
WARNING: Failed to load implementation from: com.github.fommil.netlib.NativeSystemARPACK
giu 28, 2023 12:07:11 PM com.github.fommil.netlib.ARPACK
WARNING: Failed to load implementation from: com.github.fommil.netlib.NativeRefARPACK
[WekaPackageManager] Skipping package J48graft because it is not compatible with Weka 3.9.6
java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @f98a707
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at weka.core.WekaPackageClassLoaderManager.injectClasses(WekaPackageClassLoaderManager.java:792)
at weka.core.WekaPackageClassLoaderManager.injectClasses(WekaPackageClassLoaderManager.java:718)
at weka.core.WekaPackageClassLoaderManager.injectAllClassesInJar(WekaPackageClassLoaderManager.java:667)
at weka.core.WekaPackageClassLoaderManager.injectAllClassesInJar(WekaPackageClassLoaderManager.java:677)
at weka.core.WekaPackageLibIsolatingClassLoader.checkForNativeLibs(WekaPackageLibIsolatingClassLoader.java:282)
at weka.core.WekaPackageLibIsolatingClassLoader.init(WekaPackageLibIsolatingClassLoader.java:145)
at weka.core.WekaPackageLibIsolatingClassLoader.(WekaPackageLibIsolatingClassLoader.java:126)
at weka.core.WekaPackageClassLoaderManager.addPackageToClassLoader(WekaPackageClassLoaderManager.java:369)
at weka.core.WekaPackageManager.loadPackages(WekaPackageManager.java:1373)
at weka.core.WekaPackageManager.loadPackages(WekaPackageManager.java:1305)
java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @f98a707
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at weka.core.WekaPackageClassLoaderManager.injectClasses(WekaPackageClassLoaderManager.java:792)
at weka.core.WekaPackageClassLoaderManager.injectClasses(WekaPackageClassLoaderManager.java:718)
at weka.core.WekaPackageClassLoaderManager.injectAllClassesInJar(WekaPackageClassLoaderManager.java:667)
at weka.core.WekaPackageClassLoaderManager.injectAllClassesInJar(WekaPackageClassLoaderManager.java:677)
at weka.core.WekaPackageLibIsolatingClassLoader.checkForNativeLibs(WekaPackageLibIsolatingClassLoader.java:282)
at weka.core.WekaPackageLibIsolatingClassLoader.init(WekaPackageLibIsolatingClassLoader.java:145)
at weka.core.WekaPackageLibIsolatingClassLoader.(WekaPackageLibIsolatingClassLoader.java:126)
at weka.core.WekaPackageClassLoaderManager.addPackageToClassLoader(WekaPackageClassLoaderManager.java:369)
at weka.core.WekaPackageManager.loadPackages(WekaPackageManager.java:1373)
at weka.core.WekaPackageManager.loadPackages(WekaPackageManager.java:1305)
java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @f98a707
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at weka.core.WekaPackageClassLoaderManager.injectClasses(WekaPackageClassLoaderManager.java:792)
at weka.core.WekaPackageClassLoaderManager.injectClasses(WekaPackageClassLoaderManager.java:718)
at weka.core.WekaPackageClassLoaderManager.injectAllClassesInJar(WekaPackageClassLoaderManager.java:667)
at weka.core.WekaPackageClassLoaderManager.injectAllClassesInJar(WekaPackageClassLoaderManager.java:677)
at weka.core.WekaPackageLibIsolatingClassLoader.checkForNativeLibs(WekaPackageLibIsolatingClassLoader.java:282)
at weka.core.WekaPackageLibIsolatingClassLoader.init(WekaPackageLibIsolatingClassLoader.java:145)
at weka.core.WekaPackageLibIsolatingClassLoader.(WekaPackageLibIsolatingClassLoader.java:126)
at weka.core.WekaPackageClassLoaderManager.addPackageToClassLoader(WekaPackageClassLoaderManager.java:369)
at weka.core.WekaPackageManager.loadPackages(WekaPackageManager.java:1373)
at weka.core.WekaPackageManager.loadPackages(WekaPackageManager.java:1305)

Java 9

  • test compatibility with Java 9

Logging level configuration of jvm module

I suggest to implement (if there isn't already implemented) an option to configure the logging level of the jvm module, maybe an argument at the jvm.start(). At default is is set to DEBUG.

import weka.core.jvm as jvm
jvm.start()

Prints:

DEBUG:weka.core.jvm:Adding bundled jars
DEBUG:weka.core.jvm:Classpath=[...]

Thank you!

Sourceable: classifiers, filters

added support for the Sourceable interface by adding to_source() method; outputs None if the class doesn't implement the interface

double_matrix_to_ndarray falsely assumes square matrices

The implementation of double_matrix_to_ndarray assumes that the passed Java matrix is a square matrix. This may be true for confusion matrices but it's definitely an error for Classifier.distributions_for_instances. When there are more instances than class labels, distributions_for_instances works but returns a too big numpy array.

Report for Python 2.7 version of the library: fracpete/python-weka-wrapper#48

classify_instance - Null Exception

When trying to classify an instance
pred = my_model.classify_instance(inst)

it shows this error

Exception in thread "Thread-0" java.lang.NullPointerException
        weka.core.stemmers.ArabicStemmerKhoja.stem(ArabicStemmerKhoja.java:34)
        weka.classifiers.bayes.NaiveBayesMultinomialText.tokenizeInstance(NaiveBayesMultinomialText.java:413)
        weka.classifiers.bayes.NaiveBayesMultinomialText.distributionForInstance(NaiveBayesMultinomialText.java:303)
        weka.classifiers.AbstractClassifier.classifyInstance(AbstractClassifier.java:173)

        at weka.core.stemmers.ArabicStemmerKhoja.stem(ArabicStemmerKhoja.java:34)
        at weka.classifiers.bayes.NaiveBayesMultinomialText.tokenizeInstance(NaiveBayesMultinomialText.java:413)
        at weka.classifiers.bayes.NaiveBayesMultinomialText.distributionForInstance(NaiveBayesMultinomialText.java:303)
        at weka.classifiers.AbstractClassifier.classifyInstance(AbstractClassifier.java:173)

Making predictions without target variable.

Hello, Please refer to this post in stackoverflow
The question: is there a way to insert '?' character for unknown values while creating instances just before making predictions? other than reading them from .csv or .arff files

Thank you.

Access protected attribute of Java class

Question

Version:
python = "3.9.*"
python-weka-wrapper3 = "0.2.10"
python-javabridge = "4.0.3"

Hello,

I am attempting to access the attribute protected Vector<double[][]> matricesDilca of the Java class DilcaDistance (external Weka package) from Python.

A Java method toString is implemented in said class, accessible via Python method __str__. This enables the re-assembly of the attribute-included matrices somewhat awkwardly from a string representation of floating-point data.
Is there another way to more elegantly transfer an actual array along the javabridge? Is it possible to somehow access said attribute protected Vector<double[][]> matricesDilca directly from Python and assign its value to a numpy array?

Thank you very much!

Problems deserialising model trained in Fiji

I had run:
`import os
import tempfile
import traceback
import javabridge
import weka.core.jvm as jvm
#import wekaexamples.helper as helper
from weka.core.converters import Loader
from weka.core.dataset import Instances
from weka.classifiers import Classifier
import weka.core.serialization as serialization
jvm.start()

model, _ = Classifier.deserialize('omm.model')
print(model)`

Getting as return, this error:
JavaException: Unable to find class hr.irb.fastRandomForest.FastRandomForest

Im trying to use a model trained using trainable Weka in Fiji in python scripts, how can I do that?

Supply class index string to loaders

  • add optional argument class_index to Loader.load_file to allow specifying class index
  • add optional argument class_index to load_any_file to allow specifying class index
  • class_index: string representing 1-based index or first, second, third, last-2, last-1, last

Move to Weka 3.9.2

  • use Weka 3.9.2
  • avoid recompiling of weka.jar (included jars)?
  • class instantiation using Weka's Utils.forName method

create_instances_from_matrices: There are no fields in dtype int64 with version 0.1.8

Since updating to version 0.1.8, the method create_instances_from_matrices does not working the same as before with version 0.1.7. When passing a numpy-array from a pandas Dataframe with only numerical values, I get a KeyError: 'There are no fields in dtype int64.'

Stack trace

/opt/conda/lib/python3.7/site-packages/weka/core/dataset.py in create_instances_from_matrices(x, y, name)
   1589     type_x = []
   1590     for i in range(len(x[0])):
-> 1591         if np.issubdtype(x.dtype[i], np.number):
   1592             type_x.append("N")  # number
   1593             atts.append(Attribute.create_numeric("x" + str(i+1)))

KeyError: 'There are no fields in dtype float64.'

We pass a numpy array like this:

import numpy as np
import pandas as pd
import weka.core.dataset as ds

my_dataframe = pd.DataFrame(...)
weka_data = ds.create_instances_from_matrices(np.array(my_dataframe))
...

this worked flawlessly with the previous version, so using pip install python-weka-wrapper3==0.1.7 the code above runs fine.

Syntax Error

Hi,

I encountered a syntax error while trying to use weka.core.converters Loader. The error is as follows:

Traceback (most recent call last): File "/Users/username/Predictor/test.py", line 1, in <module> from weka.core.converters import Loader File "/Users/username/.conda/envs/Predictor/lib/python3.8/site-packages/weka/core/converters.py", line 18, in <module> from weka.core.classes import OptionHandler File "/Users/username/.conda/envs/Predictor/lib/python3.8/site-packages/weka/core/classes.py", line 2085 except Exception, e: ^ SyntaxError: invalid syntax

The system configuration I'm using is as follows:

  1. Java Version
    java version "1.8.0_212"
    Java(TM) SE Runtime Environment (build 1.8.0_212-b10)
    Java HotSpot(TM) 64-Bit Server VM (build 25.212-b10, mixed mode)

  2. Javabridge Version - 1.0.19

  3. PWW - Version for Python 3

  4. Operating System - MacOS Catalina

  5. Python Version - Python 3.8.3

I'm not sure if I'm missing anything but I am unable to continue. Any help would be greatly appreciated.

Thank you.

Bayes net visualize tree

error

I tried visualizing Bayes net result but appeared error as above. J48 was fine following the example given.

Train test split

Hi,

I have predetermined train and test files but can't figure out how to use evaluate my test data after a classifier has been built.

I do not want to use cross validation or anything, purely train a classifier with my existing training file then evaluate it against the test file.

In the Evaluation class I have not been able to achieve this without reshuffling my train and test files which I do not want to do.

Any recommendations would be helpful, thanks a lot!

sklweka JavaException: no/uib/cipr/matrix/Matrix

Hello,

I've got code and error below in Anaconda. My understanding was this was an old bug and resolved, but I still have this error.
Any advise would be grateful.

Regards

import sklweka.jvm as jvm
from sklweka.dataset import load_arff, to_nominal_labels
from sklweka.classifiers import WekaEstimator
from sklweka.clusters import WekaCluster
from sklweka.preprocessing import WekaTransformer
from sklearn.model_selection import cross_val_score
from sklweka.datagenerators import DataGenerator, generate_data

start JVM with Weka package support

jvm.start(packages=True)

classification

X, y, meta = load_arff("contact-lenses.arff", class_index=2)
y = to_nominal_labels(y)
j48 = WekaEstimator(classname="weka.classifiers.trees.J48", options=["-M", "3"])
j48.fit(X, y)
scores = j48.predict(X)
probas = j48.predict_proba(X)
print("\nJ48 on iris\nactual label -> predicted label, probabilities")
for i in range(len(y)):
print(y[i], "->", scores[i], probas[i])

stop JVM

#jvm.stop()


JavaException Traceback (most recent call last)
Input In [2], in <cell line: 2>()
1 # start JVM with Weka package support
----> 2 jvm.start(packages=True)
4 # classification
5 X, y, meta = load_arff("contact-lenses.arff", class_index=2)

File \filestore.soton.ac.uk\users\ll1d19.conda\envs\pww3\lib\site-packages\weka\core\jvm.py:156, in start(class_path, bundled, packages, system_cp, max_heap_size, system_info, auto_install, logging_level)
153 env.add_variable("WEKA_HOME", weka_home)
155 # initialize package manager
--> 156 javabridge.static_call(
157 "Lweka/core/WekaPackageManager;", "loadPackages",
158 "(Z)V",
159 False)
161 # output system info
162 if system_info:

File \filestore.soton.ac.uk\users\ll1d19.conda\envs\pww3\lib\site-packages\javabridge\jutil.py:943, in static_call(class_name, method_name, sig, *args)
941 ret_sig = sig[sig.find(')')+1:]
942 nice_args = get_nice_args(args, args_sig)
--> 943 result = fn(*nice_args)
944 return get_nice_result(result, ret_sig)

File \filestore.soton.ac.uk\users\ll1d19.conda\envs\pww3\lib\site-packages\javabridge\jutil.py:923, in make_static_call..fn(*args)
921 jexception = env.exception_occurred()
922 if jexception is not None:
--> 923 raise JavaException(jexception)
924 return result

JavaException: no/uib/cipr/matrix/Matrix

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.