Return-Path: X-Original-To: apmail-hama-commits-archive@www.apache.org Delivered-To: apmail-hama-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C430AE295 for ; Thu, 10 Jan 2013 08:45:20 +0000 (UTC) Received: (qmail 93566 invoked by uid 500); 10 Jan 2013 08:45:20 -0000 Delivered-To: apmail-hama-commits-archive@hama.apache.org Received: (qmail 93490 invoked by uid 500); 10 Jan 2013 08:45:19 -0000 Mailing-List: contact commits-help@hama.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hama.apache.org Delivered-To: mailing list commits@hama.apache.org Received: (qmail 92799 invoked by uid 99); 10 Jan 2013 08:44:52 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jan 2013 08:44:52 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jan 2013 08:44:49 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id EE1622388980; Thu, 10 Jan 2013 08:44:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1431210 - in /hama/trunk/ml/src/main/java/org/apache/hama/ml/classification: ./ ClassifierAdapter.java ClassifierConfigurationAdapter.java Date: Thu, 10 Jan 2013 08:44:28 -0000 To: commits@hama.apache.org From: tommaso@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130110084428.EE1622388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tommaso Date: Thu Jan 10 08:44:28 2013 New Revision: 1431210 URL: http://svn.apache.org/viewvc?rev=1431210&view=rev Log: [HAMA-711] - added classifier and classifier configuration adapter interfaces Added: hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierAdapter.java (with props) hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierConfigurationAdapter.java (with props) Added: hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierAdapter.java URL: http://svn.apache.org/viewvc/hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierAdapter.java?rev=1431210&view=auto ============================================================================== --- hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierAdapter.java (added) +++ hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierAdapter.java Thu Jan 10 08:44:28 2013 @@ -0,0 +1,46 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hama.ml.classification; + +/** + * A {@link ClassifierAdapter} assigns a label of type O to inputs of type I + * by the adapted implementation of a classification algorithm. + * + * NOTE: This is a simplistic adapter interface whose purpose is just to have a way of plugging in any + * classification algorithm; therefore it's not meant to be a properly generic and flexible API for classification + * but just an adapter. + */ +public interface ClassifierAdapter { + + /** + * assign a label (class) of type O to inputs of type I + * + * @param inputs the inputs as a single or array of Is + * @return the label assigned of type O + */ + public O assignClass(I... inputs); + + /** + * train the underlying classifier with an adapted configuration and a dataset + * + * @param configurationAdapter the adapted configuration to train the underlying classifier + * @param inputs the dataset as a series of inputs of type I + */ + public void train(ClassifierConfigurationAdapter> configurationAdapter, I... inputs); + +} Propchange: hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierAdapter.java ------------------------------------------------------------------------------ svn:eol-style = native Added: hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierConfigurationAdapter.java URL: http://svn.apache.org/viewvc/hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierConfigurationAdapter.java?rev=1431210&view=auto ============================================================================== --- hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierConfigurationAdapter.java (added) +++ hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierConfigurationAdapter.java Thu Jan 10 08:44:28 2013 @@ -0,0 +1,31 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hama.ml.classification; + +/** + * Adapter interface for classifier's configurations and parameters. + */ +public interface ClassifierConfigurationAdapter> { + + /** + * applies the underlying adapted configuration to the given classifier + * + * @return a new {@link ClassifierAdapter} instance with the applied configuration + */ + public C applyConfiguration(C classifier); +} Propchange: hama/trunk/ml/src/main/java/org/apache/hama/ml/classification/ClassifierConfigurationAdapter.java ------------------------------------------------------------------------------ svn:eol-style = native