Generalized Method of Moments Estimation in Python - statsmodels

I'm am trying to perform Instrumental Variable (IV) regression in Python. I saw online that the statsmodels.gmm package has the function I need (http://statsmodels.sourceforge.net/devel/gmm.html#), but when I ran import statsmodels.gmm as gmm in Python I get this error No module named gmm
. I'm using ipython with python 2.7.9. Any suggestions would be much appreciated.

GMM and related IV estimators are still in the sandbox and have not been included in the statsmodels API yet.
The import needs to be directly from the module
from statsmodels.sandbox.regression import gmm
Then, these classes can be accessed with, for example gmm.GMM
The main models that are currently available are:
GMM, IV2SLS, IVGMM, LinearIVGMM, NonlinearIVGMM
The mailing list has a recent discussion on the current status, and links to "secret" Gists
https://groups.google.com/d/msg/pystatsmodels/o6NY7qGrPw0/vzf897jy3vMJ
(I just found that the t_test doesn't work for a GMM model.)

Related

Three.js NURBS surface class name?

I'm looking at using NURBS surfaces with THREE.js,
and (what seems like older) documentation points
me to a THREE.NURBSurface class. Trouble is, I can't seem to find it in the official documentation, so I suspect it's been more recently changed.
So, my question is: under what name might I find such functionality, and where might I find a URL containing its documentation?
The class has still the name THREE.NURBSSurface. When using npm you can import it like so:
import { NURBSSurface } from 'three/examples/jsm/curves/NURBSSurface.js';
The class is undocumented so you don't find an entry in the official documentation. However, there is an official example that uses it: webgl_geometry_nurbs

Playfair Cipher in Dart/Flutter?

Is there any library for the implementation of playfair cipher in dart? Just new flutter dev and have no idea about how the 2d matrix and other functionalities would be perform in dart.
Thanks
Here's an example for Java and by following the code, the only two libraries being used are:
import java.awt.Point;
import java.util.Scanner;
Point Class is available in Dart: https://api.dart.dev/stable/2.7.1/dart-math/Point-class.html
Also for Scanner:
https://api.flutter.dev/flutter/package-string_scanner_string_scanner/StringScanner-class.html
https://pub.dev/packages/string_scanner
For 2D Vector List you'd need to use something like:
List<List<String>> // or any other object
Other than that, I'm not seeing any limitations on Dart to make it happen.
If you're looking for already good implemented encryption libraries, you have:
PointyCastle
SQLCipher

how use rapidminer model in H2O.ai

i have created a model in rapid miner. it is a classification model and save the model in pmml. i want to use this model in H2O.ai to predict further. is there any way i can import this pmml model to H2O.ai an used this for further prediction.
I appreciate your suggestions.
Thanks
H2O offers no support for importing/exporting(*) pmml models.
It is hard to offer a good suggestion without knowing your motivation for wanting to use both RapidMiner and H2O. I've not used RapidMiner in about 6 or 7 years, and I know H2O well, so my first choice would just be to re-build the model in H2O.
If you are doing a lot of pre-processing steps in RapidMiner, and that is why you want to use it, you could still do all that data munging there, then export the prepared data to csv, import that into H2O, then build the model.
*: Though I did just find this tool for converting H2O models to PMML: https://github.com/jpmml/jpmml-h2o But that is the opposite direction for what you want.

Is there a way in Force.com Apex code to "import packages / namespaces" as in java/cpp ?

As in C++ we use,
using namespace std;
Or in Java we use,
import packageName;
Is there a way to import / use a package or namespace while writing Force.com Apex code?
For instance, I am writing simple Apex in Developer Console in "Execute Anonymous Window" as
System.debug('Hello world!');
Is there any way to write something like
import System;
debug('Hello world!');
This link seemed relevant, but did not answer my syntactical concern.
Any help is appreciated! Redirecting to something obvious which I might have missed is more than welcome, Thanks!
I think this is a hidden detail in APEX. I've extended classes and referenced system methods without ever having to worry about it.
It might work to think of Salesforce managing one big import list that it adds to all of your code. When you declare a class as global it gets added to your global import list. At least this line in the documentation hints in that direction, "The global access modifier declares that this class is known by all Apex code everywhere."
Regarding namespaces, I've only seen this made available as part of managed packages. So for instance, SteelBrick's managed package QuoteQuickly has the prefix SBQQ on all of it's code. More about that here. I don't believe you can namespace in any other way.
There are some really sharp peeps over at salesforce.stackexchange.com that would know better than me though. I think you should ask over there.
EDIT At DreamForce '13 I attend a presentation by Steven Herod where he made his DTO classes inner classes and referenced them elsewhere like this: QuoteModel.QuoteRequest and QuoteModel.QuoteResponse. I asked him about it and he said it was a decent way of mimicking namespaces. I found his slide deck but it didn't include the code he demo'd live. I found this code which illustrates it a bit anyways. Look for addTextrBox.textBoxClass.

How to import package by path from string in Go?

I have a string with name of package (like "my/package/test") and I wanna import that and call some function from package.
Something like this:
func init() {
var pkg string = "test/my/pkg"
import pkg
pkg.Test()
}
PS. Thanks for help
The Go language does not allow what you mentioned in your example. This is a conscious choice. In my opinion, the reason behind this choice has to do with compiler performance and ease of code understanding by the machine. This for example enables tools such as gofix that can partially fix Go code without need for user intervention.
It also enables a programmer to clearly see all of the statically imported packages used by the program.
See also the grammar rules for source file organization in the Go language specification.
In relation to dynamically loading packages at run-time: Go has no support for loading packages at run-time. A future Go run-time might implement this feature (for example, it is occasionally being requested in messages in the golang-nuts mailing list), but the current state is that there is no support for this feature.
That's not possible in Go. The linker has to know the dependencies at compile-time, your string (and the init-function) are however evaluated at run-time. Also note, that parts of your programs which are not used, i.e. everything which isn't referred explicitly, wont even be part of the final binary - so reflection is not possible either.
If you need something like that, you have to manage the mapping on your own. You can for example use a global map in one package and use the init functions in the other packages to register the relevant functions, by adding them to the map. After that, you can use the map to do your look-ups dynamically.
Take a look at the http package for example. In a fictional blog package you might use the blog.init() function to register a couple of http handlers using the http.HandleFunc(pattern, handler) function. The main package then might call http.ListenAndServe() which looks up the right handlers at run-time.

Resources