- Timestamp:
- 10/15/15 18:41:35 (7 months ago)
- Location:
- mystic
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
mystic/examples/test_svc1.py
r830 r835 30 30 y = concatenate([ones(c1.shape[0]), -ones(c2.shape[0])]).reshape(1,nx) 31 31 32 # build the Kernel Matrix (with the linear kernel)32 # build the Kernel Matrix 33 33 # get the QP quadratic and linear terms 34 34 XX = concatenate([c1,-c2]) -
mystic/examples/test_svc2.py
r831 r835 42 42 y = concatenate([ones(c1.shape[0]), -ones(c2.shape[0])]).reshape(1,nx) 43 43 44 # build the Kernel Matrix (with the linear kernel)44 # build the Kernel Matrix 45 45 # get the QP quadratic and linear terms 46 46 XX = concatenate([c1,-c2]) -
mystic/examples/test_svr1.py
r830 r835 27 27 # get the QP quadratic term 28 28 X = concatenate([x,-x]) 29 Q = 1 + multiply.outer(X,X)29 Q = KernelMatrix(X, LinearKernel) 30 30 # get the QP linear term 31 31 Y = concatenate([y,-y]) -
mystic/mystic/abstract_solver.py
r801 r835 596 596 _cost,_raw,_args = self._cost 597 597 # check if need to 'wrap' or can return the stored cost 598 if cost in [None, _raw, _cost] and ExtraArgs in [None, _args]: 598 if (cost is None or cost is _raw or cost is _cost) and \ 599 (ExtraArgs is None or ExtraArgs is _args): 599 600 return 600 601 # get cost and args if None was given … … 651 652 _cost,_raw,_args = self._cost 652 653 # check if need to 'wrap' or can return the stored cost 653 if cost in [None, _raw, _cost] and ExtraArgs in [None, _args]\654 and self._live:654 if (cost is None or cost is _raw or cost is _cost) and \ 655 (ExtraArgs is None or ExtraArgs is _args) and self._live: 655 656 return _cost 656 657 # 'wrap' the 'new' cost function with _decorate -
mystic/mystic/scripts.py
r810 r835 674 674 __quit = False 675 675 676 instance = None 676 677 # handle the special case where list is provided by sys.argv 677 678 if isinstance(filename, (list,tuple)) and not kwds: … … 698 699 cmdargs += '' if nid is None else '--nid={} '.format(nid) 699 700 cmdargs += '' if param is None else '--param="{}" '.format(param) 700 cmdargs = filename.split() + shlex.split(cmdargs) 701 if isinstance(filename, basestring): 702 cmdargs = filename.split() + shlex.split(cmdargs) 703 else: # special case of passing in monitor instance 704 instance = filename 705 cmdargs = ['^1203@magic*key311&'] + shlex.split(cmdargs) 701 706 702 707 #XXX: note that 'argparse' is new as of python2.7 … … 757 762 758 763 try: # get logfile name 759 filename = parsed_args[0] 764 if instance: 765 filename = instance 766 else: 767 filename = parsed_args[0] 760 768 except: 761 769 raise IOError("please provide log file name") … … 804 812 # parse file contents to get (i,id), cost, and parameters 805 813 try: 806 step, param, cost = logfile_reader(filename) 814 if instance: 815 step = enumerate(instance.id) 816 if len(instance) == instance.id.count(None): 817 step = [(i,) for (i,j) in step] 818 else: 819 step = list(step) 820 param, cost = instance.x, instance.y 821 else: 822 step, param, cost = logfile_reader(filename) 807 823 except SyntaxError: 808 824 read_raw_file(filename)
Note: See TracChangeset
for help on using the changeset viewer.