当前位置: 首页>>代码示例>>Java>>正文


Java PyFunction类代码示例

本文整理汇总了Java中org.python.core.PyFunction的典型用法代码示例。如果您正苦于以下问题:Java PyFunction类的具体用法?Java PyFunction怎么用?Java PyFunction使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PyFunction类属于org.python.core包,在下文中一共展示了PyFunction类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GBMLRCoreData

import org.python.core.PyFunction; //导入依赖的package包/类
public GBMLRCoreData(ThreadCommSlave comm,
                     CoreParams coreParams,
                     IFeatureMap featureMap,
                     PyFunction pyTransformFunc,
                     boolean needPyTransform,
                     FeatureHash featureHash,
                     float uniformBaseScore,
                     boolean sampleDepdtBaseScore) {
    super(comm, coreParams, featureMap, pyTransformFunc, needPyTransform, featureHash);
    this.z = new float[MAX_2D_LEN][];
    this.randMask = new BitSet[MAX_2D_LEN];
    this.uniformBaseScore = uniformBaseScore;
    this.sampleDepdtBaseScore = sampleDepdtBaseScore;


}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:17,代码来源:GBMLRDataFlow.java

示例2: GBDTCoreData

import org.python.core.PyFunction; //导入依赖的package包/类
public GBDTCoreData(ThreadCommSlave comm,
                    DataFlow.CoreParams coreParams,
                    IFeatureMap featureMap,
                    PyFunction pyTransformFunc,
                    boolean needPyTransfor,
                    int maxFeatureDim,
                    int numTreeInGroup,
                    ILossFunction obj,
                    float baseScore,
                    boolean sampleDepdtBasePrediction) {
    super(comm, coreParams, featureMap, pyTransformFunc, needPyTransfor);
    this.initScore = new float[MAX_2D_LEN][];
    this.score = new float[MAX_2D_LEN][];

    this.DENSE_MAX_1D_SAMPLE_CNT = MAX_1D_LEN / maxFeatureDim;
    this.DENSE_MAX_1D_LEN = DENSE_MAX_1D_SAMPLE_CNT * maxFeatureDim;
    this.lastPredRound = 0;

    this.maxFeatureDim = maxFeatureDim;
    this.numTreeInGroup = numTreeInGroup;
    this.obj = obj;
    this.baseScore = baseScore;
    this.sampleDepdtBasePrediction = sampleDepdtBasePrediction;
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:25,代码来源:GBDTCoreData.java

示例3: onHandleIntent

import org.python.core.PyFunction; //导入依赖的package包/类
@Override
protected void onHandleIntent(Intent workIntent) {
	try {
		String callback = workIntent.getExtras().getString("com.runassudo.pyandroid.CALLBACK");
		
		PyFunction callbackR = ((PyAndroidApplication) getApplicationContext()).callbacks.get(callback);
		if (callbackR != null) {
			callbackR.__call__();
		} else {
			throw new NullPointerException("Tried to call undefined callback " + callback);
		}
	} catch (Exception e) {
		mHandler.post(new Runnable() {
			@Override
			public void run() {
				Toast.makeText(PyService.this, "An error occurred!", Toast.LENGTH_LONG).show();
			}
		});
		Log.e("PyAndroid", "An error occurred!", e);
	}
}
 
开发者ID:RunasSudo,项目名称:PyAndroid,代码行数:22,代码来源:PyService.java

示例4: callFunc

import org.python.core.PyFunction; //导入依赖的package包/类
public static Object callFunc(Class<?> c, String funcName, Object... binds) {
	try {
		PyObject obj = ScriptManager.python.get(funcName);
		if (obj != null && obj instanceof PyFunction) {
			PyFunction func = (PyFunction) obj;
			PyObject[] objects = new PyObject[binds.length];
			for (int i = 0; i < binds.length; i++) {
				Object bind = binds[i];
				objects[i] = Py.java2py(bind);
			}
			return func.__call__(objects).__tojava__(c);
		} else
			return null;
	} catch (PyException ex) {
		ex.printStackTrace();
		return null;
	}
}
 
开发者ID:Jarinus,项目名称:osrs-private-server,代码行数:19,代码来源:ScriptManager.java

示例5: prepare

import org.python.core.PyFunction; //导入依赖的package包/类
@Setup(Level.Trial)
public void prepare() {
  PythonInterpreter interpreter = new CodeLoader().jython("dispatch");
  dispatcher = (PyFunction) interpreter.get("dispatch");

  MonomorphicState monomorphicState = new MonomorphicState();
  monomorphicState.prepare();
  monomorphicArray = new PyArray(Object.class, monomorphicState.data);

  TriMorphicState triMorphicState = new TriMorphicState();
  triMorphicState.prepare();
  trimorphicArray = new PyArray(Object.class, triMorphicState.data);

  PolyMorphicState polyMorphicState = new PolyMorphicState();
  polyMorphicState.prepare();
  polymorphicArray = new PyArray(Object.class, polyMorphicState.data);
}
 
开发者ID:golo-lang,项目名称:golo-jmh-benchmarks,代码行数:18,代码来源:MethodDispatchMicroBenchmark.java

示例6: outputSchema

import org.python.core.PyFunction; //导入依赖的package包/类
@Override
public Schema outputSchema(Schema input) {
    if(schema != null) {
        return schema;
    } else {
        if(outputSchemaFunc != null) {
            PyFunction pf;
            try {
                pf = JythonScriptEngine.getFunction(scriptFilePath, outputSchemaFunc);
                // this should be a schema function
                PyObject schemaFunctionDef = pf.__findattr__("schemaFunction".intern());
                if(schemaFunctionDef == null) {
                    throw new IllegalStateException("Function: "
                            + outputSchemaFunc + " is not a schema function");
                }
                return (Schema)((pf.__call__(Py.java2py(input))).__tojava__(Object.class));
            } catch (IOException ioe) {
                throw new IllegalStateException("Could not find function: "
                    + outputSchemaFunc + "()", ioe);
            }
        } else {
            return new Schema(new Schema.FieldSchema(null, DataType.BYTEARRAY));
        }
    }
}
 
开发者ID:PonIC,项目名称:PonIC,代码行数:26,代码来源:JythonFunction.java

示例7: nextSamples

import org.python.core.PyFunction; //导入依赖的package包/类
private static Iterator nextSamples(String line, boolean needPyTransform, PyFunction pyTransformFunc, List<String>lineList) throws UnsupportedEncodingException {
    Iterator iter;
    if (needPyTransform) {
        iter = transform(line, pyTransformFunc).iterator();
    } else {
        lineList.set(0, line);
        iter = lineList.iterator();
    }

    return iter;
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:12,代码来源:ContinuousOnlinePredictor.java

示例8: nextSamples

import org.python.core.PyFunction; //导入依赖的package包/类
private static Iterator nextSamples(String line, boolean needPyTransform, PyFunction pyTransformFunc, List<String> lineList) throws UnsupportedEncodingException {
    Iterator iter;
    if (needPyTransform) {
        iter = transform(line, pyTransformFunc).iterator();
    } else {
        lineList.set(0, line);
        iter = lineList.iterator();
    }

    return iter;
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:12,代码来源:GBDTOnlinePredictor.java

示例9: MulticlassLinearCoreData

import org.python.core.PyFunction; //导入依赖的package包/类
public MulticlassLinearCoreData(ThreadCommSlave comm,
                                CoreParams coreParams,
                                IFeatureMap featureMap,
                                PyFunction pyTransformFunc,
                                boolean needPyTransform,
                                FeatureHash featureHash,
                                int K) {
    super(comm, coreParams, featureMap, pyTransformFunc, needPyTransform, featureHash);
    this.K = K;
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:11,代码来源:MulticlassLinearModelDataFlow.java

示例10: CoreData

import org.python.core.PyFunction; //导入依赖的package包/类
public CoreData(ThreadCommSlave comm,
                DataFlow.CoreParams coreParams,
                IFeatureMap featureMap,
                PyFunction pyTransformFunc,
                boolean needPyTransform) {
    this.comm = comm;
    this.coreParams = coreParams;
    this.featureMap = featureMap;
    this.pyTransformFunc = pyTransformFunc;
    this.needPyTransform = needPyTransform;

    this.LOG_UTILS = new LogUtils(comm, coreParams.verbose);

    this.biasDelta = coreParams.need_bias ? 1 : 0;

    this.x = new int[MAX_2D_LEN][];
    this.xidx = new int[MAX_2D_LEN][];
    this.y = new float[MAX_2D_LEN][];
    this.weight = new float[MAX_2D_LEN][];

    this.realNum = new int[MAX_2D_LEN];
    this.weightNum = new double[MAX_2D_LEN];

    this.predict = new float[MAX_2D_LEN][];

    this.needFeatureTransform = coreParams.featureParams != null &&
            coreParams.featureParams.transform != null &&
            coreParams.featureParams.transform.switch_on;
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:30,代码来源:CoreData.java

示例11: FFMCoreData

import org.python.core.PyFunction; //导入依赖的package包/类
public FFMCoreData(ThreadCommSlave comm,
                   DataFlow.CoreParams coreParams,
                   IFeatureMap featureMap,
                   PyFunction pyTransformFunc,
                   boolean needPyTransform,
                   FeatureHash featureHash,
                   int maxFeatureNum,
                   String fieldDelim,
                   Map<String, Integer> field2IndexMap) {
    super(comm, coreParams, featureMap, pyTransformFunc, needPyTransform, featureHash);
    this.maxFeatureNum = maxFeatureNum;
    this.fieldDelim = fieldDelim;
    this.field2IndexMap = field2IndexMap;
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:15,代码来源:FFMModelDataFlow.java

示例12: ContinuousCoreData

import org.python.core.PyFunction; //导入依赖的package包/类
public ContinuousCoreData(ThreadCommSlave comm,
                          DataFlow.CoreParams coreParams,
                          IFeatureMap featureMap,
                          PyFunction pyTransformFunc,
                          boolean needPyTransform,
                          FeatureHash featureHash
                        ) {
    super(comm, coreParams, featureMap, pyTransformFunc, needPyTransform);
    this.featureHash = featureHash;
}
 
开发者ID:yuantiku,项目名称:ytk-learn,代码行数:11,代码来源:ContinuousCoreData.java

示例13: __engine_init_pyfuncs

import org.python.core.PyFunction; //导入依赖的package包/类
public static void __engine_init_pyfuncs() {
	isFull = pi.get("__engine_inventory_is_full", PyFunction.class);
	contains =  pi.get("__engine_inventory_contains", PyFunction.class);
	baseOnLeftClick = pi.get("__engine_onLeftClick", PyFunction.class);
	addItem = pi.get("__engine_add_item", PyFunction.class);
	removeItem = pi.get("__engine_remove_item", PyFunction.class);
	removeItemWithSlotNumber = pi.get("__engine_remove_item_with_slot_number", PyFunction.class);
}
 
开发者ID:MitchWeaver,项目名称:sjgs,代码行数:9,代码来源:InventorySystem.java

示例14: onDestroy

import org.python.core.PyFunction; //导入依赖的package包/类
@Override
public void onDestroy() {
	super.onDestroy();
	
	try {
		PyFunction callbackR = ((PyAndroidApplication) getApplicationContext()).callbacks.get("_stop");
		if (callbackR != null) {
			callbackR.__call__();
		}
	} catch (Exception e) {
		Log.w("PyAndroid", "An error occurred while stopping.", e);
		appendLog("An error occurred while stopping.");
		appendLog(Log.getStackTraceString(e));
	}
}
 
开发者ID:RunasSudo,项目名称:PyAndroid,代码行数:16,代码来源:LaunchPyService.java

示例15: invoke

import org.python.core.PyFunction; //导入依赖的package包/类
public void invoke(String method) {
    PyObject obj = (PyObject) this.bindings.get(method);
    if (obj == null) {
        failz0r(world, pos, "Unknown function '%s'", method);
        return;
    }
    PyFunction func = (PyFunction)obj;
    try {
        func.__call__();
    } catch (RuntimeException e) {
        failz0r(world, pos, "Error running code: %s", e.toString());
    }
}
 
开发者ID:r1chardj0n3s,项目名称:pycode-minecraft,代码行数:14,代码来源:PythonCode.java


注:本文中的org.python.core.PyFunction类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。