Skip to content

Commit 2b94780

Browse files
Remove python export/peek model and related artifacts (#1311)
* Remove python export/peek model and related artifacts Remove legacy Python export/peek model phases and related resources, update client wiring and argument handling. ZinggOptions (assess/peek/export) and the Spark Python phase runner mapping were removed; python/exportModel script, Python-related helpers (argument write/JSON methods) and many test/resources/docs for the peek/export flows were deleted * Fix typo in JVM arguments package Corrects a typo in python/zingg/client.py by changing the JVM package path from zingg.common.client.argumentst to zingg.common.client.arguments so ArgumentServiceImpl.loadArguments is called from the correct package
1 parent 4f6e3c7 commit 2b94780

16 files changed

Lines changed: 10 additions & 650 deletions

File tree

common/client/src/main/java/zingg/common/client/Client.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public Client(IZArgs args, ClientOptions options, String zFactory) throws ZinggC
5959
setOptions(options);
6060
try {
6161
buildAndSetArguments(args, options);
62-
setZingg(args, options);
62+
setZingg(options);
6363
}
6464
catch (Exception e) {
6565
throw new ZinggClientException("An error has occured while setting up the client", e);
@@ -91,14 +91,14 @@ public IZinggFactory getZinggFactory() throws InstantiationException, IllegalAcc
9191

9292

9393

94-
public void setZingg(IZArgs args, ClientOptions options) throws Exception{
94+
public void setZingg(ClientOptions options) throws Exception{
9595
IZinggFactory zf = getZinggFactory();
9696
try{
9797
setZingg(zf.get(ZinggOptions.getByValue(options.get(ClientOptions.PHASE).value.trim())));
9898
}
9999
catch(Exception e) {
100-
//set default
101-
setZingg(zf.get(ZinggOptions.getByValue(ZinggOptions.PEEK_MODEL.getName())));
100+
LOG.error("Error creating zingg instance for phase " + options.get(ClientOptions.PHASE).value.trim(), e);
101+
throw e;
102102
}
103103
}
104104

common/client/src/main/java/zingg/common/client/arguments/ArgumentServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public A loadArguments(String path) throws ZinggClientException, NoSuchObjectExc
4545

4646
@Override
4747
public void writeArguments(String path, IZArgs args) throws ZinggClientException, NoSuchObjectException {
48-
ArgumentsWriter<A> argumentsWriter = writerFactory.getArgumentsWriter(WriterType.JSON);
48+
ArgumentsWriter<A> argumentsWriter = writerFactory.getArgumentsWriter(WriterType.FILE);
4949
argumentsWriter.write(path, args);
5050
}
5151

common/client/src/main/java/zingg/common/client/options/ZinggOptions.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package zingg.common.client.options;
22

3-
import java.util.HashMap;
4-
import java.util.Map;
5-
63
import zingg.common.client.ZinggClientException;
74
import zingg.common.client.util.Util;
85

6+
import java.util.HashMap;
7+
import java.util.Map;
8+
99
public class ZinggOptions {
1010

1111
public final static ZinggOption TRAIN = new ZinggOption("train");
@@ -18,9 +18,6 @@ public class ZinggOptions {
1818
public final static ZinggOption RECOMMEND = new ZinggOption("recommend");
1919
public final static ZinggOption UPDATE_LABEL = new ZinggOption("updateLabel");
2020
public final static ZinggOption FIND_AND_LABEL = new ZinggOption("findAndLabel");
21-
public final static ZinggOption ASSESS_MODEL = new ZinggOption("assessModel");
22-
public final static ZinggOption PEEK_MODEL = new ZinggOption("peekModel");
23-
public final static ZinggOption EXPORT_MODEL = new ZinggOption("exportModel");
2421

2522

2623
public static Map<String, ZinggOption> allZinggOptions;// = new HashMap<String, ZinggOption>();

common/core/src/test/resources/testPeekModel/config.json

Lines changed: 0 additions & 94 deletions
This file was deleted.

common/core/src/test/resources/testPeekModel/test.csv

Lines changed: 0 additions & 65 deletions
This file was deleted.

docs/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
* [Using Pre-existing Training Data](setup/training/addOwnTrainingData.md)
4444
* [Updating Labeled Pairs](updatingLabels.md)
4545
* [Documenting The Training Data](stepbystep/createtrainingdata/generatingdocumentation.md)
46-
* [Exporting Labeled Data](setup/training/exportLabeledData.md)
4746
* [Model Difference](stepbystep/createtrainingdata/modeldiff.md)
4847
* [Ensuring Scalability](verifyBlocking.md)
4948
* [Building And Saving The Model](setup/train.md)

docs/setup/training/addOwnTrainingData.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,4 @@ Here, the first column specifies the z_cluster, the second column specifies the
1717

1818
The above training data can be specified using [trainingSamples attribute in the configuration.](../../../examples/febrl/configWithTrainingSamples.json)
1919

20-
In addition, labeled data of one model can also be exported and used as training data for another model. For details, check out [exporting labeled data](exportLabeledData.md).
21-
2220
**Note**: It is advisable to still run [findTrainingData](findTrainingData.md) and [label](label.md) a few rounds to tune Zingg with the supplied training data as well as patterns it needs to learn independently.

docs/setup/training/exportLabeledData.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

python/phases/exportModel.py

Lines changed: 0 additions & 52 deletions
This file was deleted.

python/zingg/client.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -670,14 +670,6 @@ def setLabelDataSampleSize(self, labelDataSampleSize):
670670
"""
671671
self.args.setLabelDataSampleSize(labelDataSampleSize)
672672

673-
def writeArgumentsToJSON(self, fileName):
674-
"""Method to write JSON file from the object of this class
675-
676-
:param fileName: The CONF parameter value of ClientOption object or file address of json file
677-
:type fileName: String
678-
"""
679-
getJVM().zingg.common.client.arguments.ArgumentServiceImpl().writeArguments(fileName, self.args)
680-
681673
def setStopWordsCutoff(self, stopWordsCutoff):
682674
"""Method to set stopWordsCutoff parameter value
683675
By default, Zingg extracts 10% of the high frequency unique words from a dataset. If user wants different selection, they should set up StopWordsCutoff property
@@ -708,32 +700,9 @@ def createArgumentsFromJSON(fileName, phase):
708700
:rtype: pointer(Arguments)
709701
"""
710702
obj = Arguments()
711-
obj.args = getJVM().zingg.common.client.argumentst.ArgumentServiceImpl().loadArguments(fileName)
703+
obj.args = getJVM().zingg.common.client.arguments.ArgumentServiceImpl().loadArguments(fileName)
712704
return obj
713705

714-
def writeArgumentsToJSONString(self):
715-
"""Method to create an object of this class from the JSON file and phase parameter value.
716-
717-
:param fileName: The CONF parameter value of ClientOption object
718-
:type fileName: String
719-
:param phase: The PHASE parameter value of ClientOption object
720-
:type phase: String
721-
:return: The pointer containing address of the this class object
722-
:rtype: pointer(Arguments)
723-
"""
724-
jsonString = getJVM().java.lang.String()
725-
return getJVM().zingg.common.client.arguments.ArgumentServiceImpl().writeArguments(jsonString, self.args)
726-
727-
@staticmethod
728-
def createArgumentsFromJSONString(jsonArgs, phase):
729-
obj = Arguments()
730-
obj.args = getJVM().zingg.common.client.arguments.ArgumentServiceImpl().loadArguments(jsonArgs)
731-
return obj
732-
733-
def copyArgs(self, phase):
734-
argsString = self.writeArgumentsToJSONString()
735-
return self.createArgumentsFromJSONString(argsString, phase)
736-
737706

738707
class ClientOptions:
739708
"""Class that contains Client options for Zingg object
@@ -770,7 +739,6 @@ def __init__(self, argsSent=None):
770739
args = argsSent.copy()
771740
if self.PHASE not in args:
772741
args.append(self.PHASE)
773-
args.append("peekModel")
774742
if self.LICENSE not in args:
775743
args.append(self.LICENSE)
776744
args.append("zinggLic.txt")
@@ -922,7 +890,7 @@ def parseArguments(argv):
922890
"""
923891
parser = argparse.ArgumentParser(description="Zingg's python APIs")
924892
mandatoryOptions = parser.add_argument_group("mandatory arguments")
925-
mandatoryOptions.add_argument("--phase", required=True, help="python phase e.g. assessModel")
893+
mandatoryOptions.add_argument("--phase", required=True)
926894
mandatoryOptions.add_argument(
927895
"--conf",
928896
required=True,

0 commit comments

Comments
 (0)