text:
/**************************** EXTERNAL IMPORTS *******************************/

var request = require("request"); // For making REST calls
var underscore = require("underscore"); // For general utility methods
var qs = require("querystring"); // For reading authentication responses
var rs = require("randomstring"); // For nonce generation
var crypto = require("crypto"); // For signature generation
var URL = require("url"); // For url analysis

/**************************** INTERNAL IMPORTS *******************************/

var assert = require("../../assert.js");
var ex = require("../../exception.js");
var apiEx = require("../api.exceptions.js");
var log = require("../../log.js");
var callbackCache = require("../../session/callback.cache.js");
var apiUtil = require("../util/oauth1.util.js");
var Client = require("../client/oauth1.client.js");

/**************************** MODULE CONSTANTS *******************************/

var HTTP_PROTOCOL_PREFIX = "http://"; // Do I really need to explain this
var OAUTH_GRANT_TYPE = "grant_type";
var HTTP_POST_METHOD = "POST"; // Do I really need to explain this
var URL_PATH_SEPARATOR = "/"; // To reduce string creation ever so slightly - this may be a bit anal
var DEFAULT_API_ROOT = "/sauce/apis"; // What the api specific routes will get prepended with, if its not overridden
var DEFAULT_REDIRECT_ROUTE_SUFFIX = "/redirect"; // What we suffix redirect api routes with, if its not overridden
var SAUCE_SESSION_KEY_PREFIX = "_sauce";
var SAUCE_SESSION_AUTH_RETURN_URL_KEY = SAUCE_SESSION_KEY_PREFIX + "ApiAuthReturnUrl"; // This is where we go after OAuth loop has finished

/*************************** INSTANCE VARIABLES ******************************/

var _authRedirectUrl = null;

/**************************** INSTANCE METHODS *******************************/

// Returns the fully qualified redirect url
var authRedirectUrl = function(req, route) {
    if (!_authRedirectUrl) {
        _authRedirectUrl = HTTP_PROTOCOL_PREFIX + req.get("host") + route;
    }
    return _authRedirectUrl;
}

/*************************** OBJECT DEFINITIONS ******************************/

/* The base API type that specific implementations will extends. Supports all
 * the methods required by Sauce Apis, but its specifically geared for OAuth
 * 1.0 compliance. <i>This function is a constructor</i>.
 *
 * @param apiName name of the api implementation e.g. 'google' or 'dropbox'
 * @param sauceConfigMap general sauce configuration object e.g. 'config.apiRoot' or 'config.isLoggingDebug'
 *      Properties of sauceConfigMap:
 *          - apiRoot - the url fragment that prepends api routes; defaults to '/sauce/apis'
 * @param apiConfigMap api-specific configuration object e.g. 'config.clientId' or 'config.clientSecret'
 *      Properties of apiConfigMap:
 *          - consumerKey - String - Consumer Key as defined by the api service
 *          - consumerSecret - String - Consumer Secret as defined by the api service
 * @param extensionMap settings for customization of functionality
 *      Properties of extensionMap:
 *          - authUrl - REQUIRED - String - url for api authentication redirect
 *          - accessTokenUrl - REQUIRED - String - url for fetching access token
 *          - requestTokenUrl - RECOMMENDED - String - url for fetching request token
 *          - requestUrl - RECOMMENDED - String - base url for submitting api requests after we're authed
 *          - authSignatureMethod - RECOMMENDED - String - signature method e.g. HMAC-SHA1, PLAINTEXT
 *          - authNonceLength - RECOMMENDED - Integer - how long the nonce string has to be, defaults to 32
 *          - clientExtensionMap - REQUIRED - Map/Object - specific map of properties for the api request client
 *              - authorizationHeaderPrefix - OPTIONAL - String - the string that prepends the auth token in the authorization header; authorization header is excluded if this is null
 *              - authorizationTokenParameterKey - OPTIONAL - String - if specified, auth token is included in api request query string - identified by the authorizationTokenParameterKey string
 *
 */
module.exports = function(apiName, sauceConfigMap, apiConfigMap, extensionMap) {

    /********************* INSTANCE VARIABLES *********************/

    // First, we preserve our context
    var $ = this;
    // Lets get started
    assert.string(apiName, "apiName");
    // Lets put session keys together
    var camelCaseApiName = apiName.charAt(0).toUpperCase() + apiName.slice(1);
    var authTokenSessionKey = SAUCE_SESSION_KEY_PREFIX + camelCaseApiName + "AuthToken";
    var authTokenSecretSessionKey = SAUCE_SESSION_KEY_PREFIX + camelCaseApiName + "AuthTokenSecret";
    var authTokenExpirationSessionKey = SAUCE_SESSION_KEY_PREFIX + camelCaseApiName + "AuthTokenExpiration";
    var authSuccessCallbackIdSessionKey = SAUCE_SESSION_KEY_PREFIX + camelCaseApiName + "SuccessCallbackId";
    var authFailureCallbackIdSessionKey = SAUCE_SESSION_KEY_PREFIX + camelCaseApiName + "FailureCallbackId";
    var authGeneralCallbackIdSessionKey = SAUCE_SESSION_KEY_PREFIX + camelCaseApiName + "CallbackId";
    // First check that apiConfigMap was defines
    assert.object(apiConfigMap, "apiConfigMap");
    // Create the standard auth params
    var consumerKey = apiConfigMap.consumerKey; // OAuth Consumer Key; everyone needs this
    var consumerSecret = apiConfigMap.consumerSecret; // OAuth Client Secret; everyone needs this too
    // We need to make sure we have at least id and secret
    assert.string(consumerKey, "consumerKey");
    assert.string(consumerSecret, "consumerSecret");
    // We need to check extension property for 'requiresScopes' - so, of course, the extensionMap has to exist first
    assert.object(extensionMap, "extensionMap");
    // Moving on, lets create the more general config-specific instance variables
    assert.object(sauceConfigMap, "sauceConfigMap");
    var apiRoot = (sauceConfigMap.apiRoot) ? sauceConfigMap.apiRoot : DEFAULT_API_ROOT;
    // Some api root corrections for later (never trust the user) - the root must start with a '/' but not end with one
    if (apiRoot.charAt(0) !== URL_PATH_SEPARATOR) apiRoot = URL_PATH_SEPARATOR + apiRoot;
    if (apiRoot.charAt(apiRoot.length) === URL_PATH_SEPARATOR) apiRoot = apiRoot.slice(0, apiRoot.length - 1);
    // Setup the redirect route url up here for ease of reuse
    var redirectRouteUrl = apiRoot + URL_PATH_SEPARATOR + apiName + DEFAULT_REDIRECT_ROUTE_SUFFIX;
    // Now we check the extension map for api urls: we need an 'authUrl', a 'tokenUrl' and, finally, a 'requestUrl'
    var authUrl = extensionMap.authUrl;
    var accessTokenUrl = extensionMap.accessTokenUrl;
    var requestTokenUrl = extensionMap.requestTokenUrl;
    var requestUrl = extensionMap.requestUrl;
    // Ugh, more parameter checking
    assert.string(authUrl, "authUrl");
    assert.string(accessTokenUrl, "accessTokenUrl");
    assert.string(requestTokenUrl, "requestTokenUrl");
    // assert.string(requestUrl, "requestUrl"); // Shouldn't be fixed for some apis e.g. dropbox
    // Ok, we got this far, sweet
    var routed = false; // Flag that indicates whether route(..) has already been invoked
    var client = null; // The instance of this api's client

    /********************** INSTANCE METHODS **********************/

    // Returns a configuration item by key. Returns null if the key could not be matched.
    this.config = function(key) {
        if (!key) return null;
        if (sauceConfigMap[key]) return sauceConfigMap[key];
        if (apiConfigMap[key]) return apiConfigMap[key];
        if (extensionMap[key]) return extensionMap[key];
        return null;
    };
    // Returns a map of the authentication data for this session. If we aren't
    // authed yet, this method will return null.
    this.credentials = function(session) {
        // Do parameter checking
        assert.object(session, "session");
        if (session[authTokenSessionKey] && session[authTokenSecretSessionKey]) {
            // We appear to be authed at the moment
            return {
                token: session[authTokenSessionKey],
                tokenSecret: session[authTokenSecretSessionKey]
            };
        }
        // We're not authed as it happens, so return null
        return null;
    };
    // Creates an api client for this api. This is implemented entirely by
    // subtypes of OAuth1Api
    this.request = function(session, method, url) {
        // Do parameter check
        assert.string(method, "method");
        assert.string(url, "url");
        // Make the client if it doesn't already exist
        if (!client) {
            client = new Client(this, requestUrl);
        }
        // Use the client to poop out the request object
        return chain = client.request(session, method, url);
    };
    // Identifies this API with a human readable string. Doesn't necessarily
    // have to be the apiName.
    this.identity = function() {
        return apiName;
    };
    // Given the session, returns true if we have already authenticated
    // against this api.
    this.authed = function(session) {
        // Make sure we have a session
        assert.object(session, "session");
        // First check if there is an expiration
        if (session[authTokenExpirationSessionKey] && session[authTokenExpirationSessionKey] <= (new Date()).getTime()) {
            // This token is no good anymore
            lod.w("'" + apiName + "' api authorization token has expired due to its age.");
            session[authTokenSessionKey] = null;
        }
        // We're authed if we have a token
        if (session[authTokenSessionKey]) {
            return true;
        } else {
            return false;
        }
    };
    // Executes actual authentication. Requires a return url so that we have
    // somewhere to come back to when authentication is complete.
    this.auth = function(app, req, res, returnUrl) {
        if (!routed) $.route(app); // We route in auth() because this way it doen't interfere with the middleware loading order
        assert.object(app, "app");
        assert.object(req, "req");
        assert.object(res, "res");
        assert.string(returnUrl, "returnUrl");
        // We have to start the OAuth flow by requesting the token
        req.session[SAUCE_SESSION_AUTH_RETURN_URL_KEY] = returnUrl;
        // Build chain
        var chain = {
            success: function(callback) {
                // Put the callback in the cache so that we can call it way later
                assert.funktion("callback", callback);
                // We need to store the callbackCache
                successCallback = callback;
                var callbackId = callbackCache.push(callback, 60000);
                // Get rid of old orphan callbacks
                if (req.session[authSuccessCallbackIdSessionKey]) callbackCache.pop(req.session[authSuccessCallbackIdSessionKey]);
                // Store this new callback id
                req.session[authSuccessCallbackIdSessionKey] = callbackId;

                return chain;
            },
            failure: function(callback) {
                // Put the callback in the cache so that we can call it way later
                assert.funktion("callback", callback);
                // We need to store the callbackCache
                doFailure = callback;
                var callbackId = callbackCache.push(callback, 60000);
                // Get rid of old orphan callbacks
                if (req.session[authFailureCallbackIdSessionKey]) callbackCache.pop(req.session[authFailureCallbackIdSessionKey]);
                // Store this new callback id
                req.session[authFailureCallbackIdSessionKey] = callbackId;

                return chain;
            },
            call: function(callback) {
                if (callback) {
                    assert.funktion("callback", callback);
                    // We need to store the callbackCache
                    var callbackId = callbackCache.push(callback);
                    // Get rid of old orphan callbacks
                    if (req.session[authGeneralCallbackIdSessionKey]) callbackCache.pop(req.session[authGeneralCallbackIdSessionKey]);
                    // Store this new callback id
                    req.session[authGeneralCallbackIdSessionKey] = callbackId;
                }
                // Attempt to get request token
                request({
                    method: "POST",
                    headers: {
                        Authorization: apiUtil.buildAuthHeader({
                            headerPrefix: "OAuth",
                            nonceLength: 32,
                            consumerKey: consumerKey,
                            consumerSecret: consumerSecret,
                            requestUrl: requestTokenUrl,
                            redirectUrl: authRedirectUrl(req, redirectRouteUrl),
                            signatureMethod: extensionMap.authSignatureMethod
                        })
                    },
                    url: requestTokenUrl
                }, function(error, response, body) {
                    if (error || response.statusCode > 299) {
                        if (!error) error = new apiEx.APICallFailureException("Api call to URL '" + requestTokenUrl + "' failed with status code " + response.statusCode + ".\nThe body was as follows: \n" + body);
                        // Died violently - now to shout about it
                        var callback = null;
                        // Fire the fail callbacks
                        if (req.session[authFailureCallbackIdSessionKey]) {
                            callback = callbackCache.pop(req.session[authFailureCallbackIdSessionKey]);
                            req.session[authFailureCallbackIdSessionKey] = null;
                            if (callback) callback(error);
                        }
                        if (req.session[authGeneralCallbackIdSessionKey]) {
                            callback = callbackCache.pop(req.session[authGeneralCallbackIdSessionKey]);
                            req.session[authGeneralCallbackIdSessionKey] = null;
                            if (callback) callback(error);
                        }
                        // Send back a 500
                        res.json(500, error);
                    } else {
                        // Nothing broke - yet
                        var payload = qs.parse(body);
                        // Time to do the redirect
                        var args = {
                            oauth_token: payload.oauth_token
                        };
                        res.redirect(authUrl + "?" + qs.stringify(args));
                    }
                });
            }
        };
        return chain;
    }
    // Creates all routes required by the OAuth 1.0 roundtrip. This involves creating a redirect
    // route that requests the authentication token.
    this.route = function(app) {
        // Internal callback handlers
        // Only route if its our first time
        if (!routed) {
            // Convenience method to uniformly handle the positive case.
            var doSuccess = function(req, token) {
                if (req.session[authSuccessCallbackIdSessionKey]) {
                    var callback = callbackCache.pop(req.session[authSuccessCallbackIdSessionKey]);
                    if (callback) callback(token);
                    else log.w("The success callback for '" + apiName + "' api authentication expired.");
                    // Reset the session's callback memory
                    req.session[authSuccessCallbackIdSessionKey] = null;
                }
                if (req.session[authGeneralCallbackIdSessionKey]) {
                    var callback = callbackCache.pop(req.session[authGeneralCallbackIdSessionKey]);
                    if (callback) callback(null, token);
                    else log.w("The callback for '" + apiName + "' api authentication expired.");
                    // Reset the session's callback memory
                    req.session[authGeneralCallbackIdSessionKey] = null;
                }
            };
            // Convenience method to uniformly handle the negative case.
            var doFailure = function(req, err) {
                if (req.session[authFailureCallbackIdSessionKey]) {
                    var callback = callbackCache.pop(req.session[authFailureCallbackIdSessionKey]);
                    if (callback) callback(err);
                    else log.w("The failure callback for '" + apiName + "' api authentication expired.");
                    // Reset the session's callback memory
                    req.session[authFailureCallbackIdSessionKey] = null;
                }
                if (req.session[authGeneralCallbackIdSessionKey]) {
                    var callback = callbackCache.pop(req.session[authGeneralCallbackIdSessionKey]);
                    if (callback) callback(err);
                    else log.w("The callback for '" + apiName + "' api authentication expired.");
                    // Reset the session's callback memory
                    req.session[authGeneralCallbackIdSessionKey] = null;
                }
            };
            // Gotta make sure we have the app defined
            if (!app) throw new ex.IllegalArgumentException("The express app parameter was null.");
            // Now we register the redirect route
            app.get(redirectRouteUrl, function(req, res) {
                // Read input parameters from service provider
                var requestToken = req.param("oauth_token");
                var requestTokenSecret = req.param("oauth_token_secret");
                var oauthVerifier = req.param("oauth_verifier");
                // Make sure we have token before we go anywhere
                if (!requestToken) {
                    var msg;
                    // TODO we need failure callback here
                    msg = "The 'oauth_token' parameter received in '" + apiName + "' api redirect was null.";
                    log.e(msg);
                    // Let the caller know it didn't work out
                    doFailure(req, new apiEx.APICallFailureException(msg));
                    // Go back to wence we came from, because this didn't work
                    if (req.session[SAUCE_SESSION_AUTH_RETURN_URL_KEY]) res.redirect(req.session[SAUCE_SESSION_AUTH_RETURN_URL_KEY]);
                    else {
                        // Uh oh, return url wasn't provided - that's not fun
                        log.e("The sauce return url was null after finishing authentication for '" + apiName + "' api, so we have to send a 404.");
                        res.send(404);
                    }
                    return;
                } else {
                    // Attempt to get access token
                    request({
                        method: "POST",
                        headers: {
                            Authorization: apiUtil.buildAuthHeader({
                                headerPrefix: "OAuth",
                                nonceLength: 32,
                                consumerKey: consumerKey,
                                consumerSecret: consumerSecret,
                                requestUrl: accessTokenUrl,
                                signatureMethod: extensionMap.authSignatureMethod,
                                token: requestToken,
                                tokenSecret: requestTokenSecret,
                                verifier: oauthVerifier
                            })
                        },
                        url: accessTokenUrl
                    }, function(error, response, body) {
                        if (error || response.statusCode > 299) {
                            if (!error) error = new apiEx.APICallFailureException("Api call to URL '" + accessTokenUrl + "' failed with status code " + response.statusCode + ".\nThe body was as follows: \n" + body);
                            // So close, and yet, so far
                            doFailure(req, error);
                        } else {
                            // Got what we needed, lets finish up
                            var payload = qs.parse(body);
                            req.session[authTokenSessionKey] = payload.oauth_token;
                            req.session[authTokenSecretSessionKey] = payload.oauth_token_secret;
                            // Let's finish up
                            doSuccess(req, payload.oauth_token);
                        }
                        // Go back to wence we came from, because this didn't work
                        if (req.session[SAUCE_SESSION_AUTH_RETURN_URL_KEY]) res.redirect(req.session[SAUCE_SESSION_AUTH_RETURN_URL_KEY]);
                        else {
                            // Uh oh, return url wasn't provided - that's not fun
                            log.e("The sauce return url was null after finishing authentication for '" + apiName + "' api, so we have to send a 404.");
                            res.send(404);
                        }
                    });
                }
            });
        } else {
            throw new apiEx.APIAlreadyRoutedException(apiName);
        }
    };
    // Init is now complete
    log.d("'" + apiName + "' api was initialized successfully.");
};


text:
#if !defined(DD_MODEL) && !defined(WIN32)
#define DD_MODEL

#define use_speed_ 0
#include <cv.h>
#include <boost/concept_check.hpp>

#include <functional>
#include <Detection.hpp>

#include "QP.hpp"
#include "DepthFeatures.hpp"
#include "MetaData.hpp"
#include "util.hpp"
#include "FeatPyr.hpp"
#include "Visualization.hpp"

namespace deformable_depth
{
  class Model_Builder;
  class MetaData;

  class Model
  {
  public:
    struct TrainParams
    {
      int positive_iterations;
      int negative_iterations;
      // additional files from which to extract only negatives (used in GMM training)
      vector<shared_ptr<MetaData>> negatives_only;
      TrainParams(int p, int n) : positive_iterations(p), negative_iterations(n){};
      TrainParams() : positive_iterations(1), negative_iterations(1){};
      TrainingBBSelectFn part_subset;
      string subset_cache_key; // used to identify the cache location
      // used to configure mixtures in a mixture model
      shared_ptr<Model_Builder> subordinate_builder;
    };
  public:
    // pure virtual methods
    virtual DetectionSet detect(const ImRGBZ&im,DetectionFilter filter) const = 0;
    virtual void train(vector<shared_ptr<MetaData>>&training_set,TrainParams train_params = TrainParams()) = 0;
    virtual Mat show(const string&title = "Model") = 0;

    // has default implementations
    virtual void train_on_test(vector<shared_ptr<MetaData>>&training_set,TrainParams train_params = TrainParams());
    virtual Mat vis_result(const ImRGBZ&,Mat&background,DetectionSet&dets) const;
    virtual Visualization visualize_result(const ImRGBZ&im,Mat&background,DetectionSet&dets) const;
    virtual ~Model(){};
    virtual double min_area() const {return 1;};
    virtual bool is_part_model() const {return false;};
    virtual bool write(FileStorage&fs) {return false;};
  };
}

#include "Training.hpp"

namespace deformable_depth
{
  using namespace cv;
  using namespace std;

  // forward declare
  class MetaData;
  string printfpp(const char*format,...);

  struct BadBoundingBoxException : std::exception
  {
  };

  class Model_Builder
  {
  public:
    virtual Model* build(Size gtSize,Size imSize) const = 0;
    virtual string name() const = 0;
    virtual ~Model_Builder() {};
  };

  template<typename T>
  class TrivialModelBuilder : public Model_Builder
  {
  public:
    virtual Model* build(Size gtSize,Size imSize) const
    {
      return new T;
    }
    virtual string name() const
    { return "Trivial";};
    virtual ~TrivialModelBuilder() {};
  };
}

#endif

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>OpenNI 2.0: Member List</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>

<link href="doxygen.css" rel="stylesheet" type="text/css" />

OpenNI 2.0

Main Page

Related Pages

Namespaces

Classes

Files

Class List

Class Index

Class Members

openni

OpenNI

DeviceConnectedListener

openni::OpenNI::DeviceConnectedListener Member List

This is the complete list of members for openni::OpenNI::DeviceConnectedListener, including all inherited members.

DeviceConnectedListener()	openni::OpenNI::DeviceConnectedListener	inline

onDeviceConnected(const DeviceInfo *)=0	openni::OpenNI::DeviceConnectedListener	pure virtual

OpenNI class	openni::OpenNI::DeviceConnectedListener	friend

~DeviceConnectedListener()	openni::OpenNI::DeviceConnectedListener	inlinevirtual

<address class="footer">
Generated on Thu Jul 17 2014 13:05:28 for OpenNI 2.0 by

 1.8.1.2
</address>


text:
package laika.rewrite

import scala.collection.mutable.ListBuffer
import scala.collection.mutable.Stack
import laika.tree.Documents.TreePosition
import laika.tree.Elements._

/** Rewrite rules responsible for building the section structure
 *  of a document based on the header elements it contains and
 *  their level.
 *
 * @author Jens Halm
 */
object SectionBuilder extends (DocumentCursor => RewriteRule) {

  class DefaultRule (cursor: DocumentCursor) {

    class Builder (header:Header, id: String) {

      val styledHeader: Header = header.copy(options = header.options + Styles("section"))

      private val buffer = new ListBuffer[Block]

      def += (block: Block): Unit = buffer += block

      def >= (level: Int): Boolean = header.level >= level

      def toSection: Section = Section(styledHeader, buffer.toList)

    }

    def buildSections (document: RootElement): RootElement = {

      val sectionStructure: Seq[Block] = {

        val stack = new Stack[Builder]
        stack push new Builder(Header(0,Nil), "")

        def closeSections (toLevel: Int): Unit = {
          while (stack.nonEmpty && stack.top >= toLevel) {
            val section = stack.pop.toSection
            stack.top += section
          }
        }

        document.content.foreach {
          case h @ Header(level, _, Id(id)) => closeSections(level); stack push new Builder(h, id)
          case block                        => stack.top += block
        }

        closeSections(1)

        stack.pop.toSection.content
      }

      val numberedSections: Seq[Block] = {

        val autonumberConfig = AutonumberConfig.fromConfig(cursor.config)

        val hasTitle = sectionStructure collect { case s:Section => s } match {
          case _ :: Nil => true
          case _ => false
        }
        val docPosition =
          if (autonumberConfig.documents) cursor.position
          else TreePosition.root

        def transformRootBlocks (blocks: Seq[Block]): Seq[Block] =
          (ListBuffer[Block]() /: blocks) {
            case (acc, s: Section) => acc ++= transformRootSection(s)
            case (acc, block) => acc += block
          }.toList

        def transformRootSection (s: Section): Seq[Block] = {
          val options = SomeOpt(s.header.options.id, s.header.options.styles - "section" + "title")
          val title = if (autonumberConfig.documents) Title(addNumber(s.header.content, docPosition), options)
                      else Title(s.header.content, options)
          val content = if (autonumberConfig.sections) numberSections(s.content, docPosition) else s.content
          title +: content
        }

        def addNumber (spans: Seq[Span], position: TreePosition): Seq[Span] = position.toSpan +: spans

        def numberSection (s: Section, position: TreePosition): Section = s.copy(
          header = s.header.copy(
              content = addNumber(s.header.content, position),
              options = s.header.options + Styles("section")
          ),
          content = numberSections(s.content, position)
        )

        def numberSections (blocks: Seq[Block], parentPosition: TreePosition, hasTitle: Boolean = false): Seq[Block] = {
          ((ListBuffer[Block](), 1, hasTitle) /: blocks) {
            case ((acc, num, title), s: Section) =>
              val elements =
                if (title) transformRootSection(s)
                else if (parentPosition.depth < autonumberConfig.maxDepth) numberSection(s, parentPosition.forChild(num)) :: Nil
                else List(s)
              (acc ++= elements, if (title) num else num + 1, false)
            case ((acc, num, title), block) => (acc += block, num, title)
          }._1.toList
        }

        if (autonumberConfig.sections) numberSections(sectionStructure, docPosition, hasTitle)
        else if (hasTitle) transformRootBlocks(sectionStructure)
        else sectionStructure
      }

      RootElement(numberedSections)
    }

    val rewrite: RewriteRule = {
      case root: RootElement => Some(buildSections(root))
    }
  }

  /** Provides the default rewrite rules for building the section structure
   *  for the specified document (without applying them).
   */
  def apply (cursor: DocumentCursor): RewriteRule = new DefaultRule(cursor).rewrite

}


text:
#pragma once

#include <thrust/iterator/iterator_traits.h>

namespace thrust
{
namespace system
{
namespace cuda
{
namespace detail
{
namespace detail
{

template<typename RandomAccessIterator1,
         typename RandomAccessIterator2,
         typename RandomAccessIterator3,
         typename RandomAccessIterator4,
         typename Compare,
         typename Size1,
         typename Size2,
         typename Size3>
  void get_set_operation_splitter_ranks(RandomAccessIterator1 first1,
                                        RandomAccessIterator1 last1,
                                        RandomAccessIterator2 first2,
                                        RandomAccessIterator2 last2,
                                        RandomAccessIterator3 splitter_ranks1,
                                        RandomAccessIterator4 splitter_ranks2,
                                        Compare comp,
                                        Size1 partition_size,
                                        Size2 num_splitters_from_range1,
                                        Size3 num_splitters_from_range2);

} // end detail
} // end detail
} // end cuda
} // end system
} // end thrust

#include <thrust/system/cuda/detail/detail/get_set_operation_splitter_ranks.inl>


text:
TARGET = BirthdayBook
TARGET_TEST = BirthdayBookTest
JUNIT = junit-4.11.jar
HAMCREST = hamcrest-core-1.3.jar

all:
	@clear
	@javac $(TARGET).java
	@java $(TARGET)
	@rm *.class

test:
	@clear
	@javac -cp $(JUNIT):$(HAMCREST) $(TARGET_TEST).java $(TARGET).java
	@java -cp $(JUNIT):$(HAMCREST):$(PWD) $(TARGET_TEST)
	@rm *.class


text:
{% extends "zinnia/entry_list.html" %}
{% load i18n %}

{% block meta-description %}{% trans "Today archives" %} {{ day|date:"DATE_FORMAT" }}{% endblock meta-description %}

{% block title %}{% trans "Today archives" %} {{ day|date:"DATE_FORMAT" }}{% endblock title %}

{% block body-class %}{{ block.super }} archive date today year-{{ day|date:"Y" }} month-{{ day|date:"m" }} week-{{ day|date:"W" }} day-{{ day|date:"d" }}{% endblock body-class %}

{% block content-title %}

{% trans "Today archives" %}

{% endblock content-title %}

{% block content-related %}
{% if previous_day %}

{% trans "Previous day" %}

  {{ previous_day|date:"DATE_FORMAT" }}

{% endif %}

{% trans "Archives" %}

    {{ day|date:"Y" }}

  {% if previous_month %}

    {{ previous_month|date:"YEAR_MONTH_FORMAT" }}

  {% endif %}

    {{ day|date:"YEAR_MONTH_FORMAT" }}

{% endblock content-related %}


text:
import { ChangeDetectionStrategy, Component, Input, ViewChild, ViewContainerRef } from '@angular/core';
import { FormControl } from '@angular/forms';
import { FieldWrapper, FormlyConfig, FormlyFieldConfig } from '@ngx-formly/core';

// wrapper
@Component({
	selector: 'lu-formly-wrapper-error',
	styleUrls: ['flex-layout.scss'],
	templateUrl: './error.html',
	changeDetection: ChangeDetectionStrategy.OnPush,
})
// eslint-disable-next-line @angular-eslint/component-class-suffix
export class LuFormlyWrapperError extends FieldWrapper {
	@ViewChild('fieldComponent', { read: ViewContainerRef, static: true })
	override fieldComponent: ViewContainerRef;

	override readonly formControl: FormControl;

	get validationId() {
		return this.field.id + '-message';
	}
}

// component that display the right error message
@Component({
	selector: 'lu-formly-error-message',
	template: `<div class="textfield-messages-error" *ngFor="let message of errorMessages">
		{{ message }}
	</div>`,
	changeDetection: ChangeDetectionStrategy.OnPush,
})
// eslint-disable-next-line @angular-eslint/component-class-suffix
export class LuFormlyErrorMessage {
	@Input() fieldForm: FormControl;
	@Input() field: FormlyFieldConfig;

	get errorMessages(): string[] {
		const messages: string[] = [];
		if (this.fieldForm.errors) {
			Object.keys(this.fieldForm.errors).forEach((key) => {
				if (this.field.validation?.messages?.[key]) {
					messages.push(this.field.validation.messages[key] as string);
				}
			});
		}
		return messages;
	}
}

// run to know when to add said wrapper
export class TemplateError {
	run(fc: FormlyConfig) {
		fc.templateManipulators.postWrapper.push((field: FormlyFieldConfig) => {
			if (field && field.validation) {
				return 'error';
			}
			return '';
		});
	}
}


text:
<!DOCTYPE html>

	<title>

            Dr. Carole Henri -

    Complete profile - Canadian Company Capabilities - Industries and Business - Industry Canada
  </title>

<meta charset="utf-8" />
<meta name="dcterms.language" title="ISO639-2" content="eng" />
<meta name="dcterms.title" content="" />
<meta name="description" content="" />
<meta name="dcterms.description" content="" />
<meta name="dcterms.type" content="report, data set" />
<meta name="dcterms.subject" content="businesses, industry" />
<meta name="dcterms.subject" content="businesses, industry" />
<meta name="dcterms.issued" title="W3CDTF" content="" />
<meta name="dcterms.modified" title="W3CDTF" content="" />
<meta name="keywords" content="" />

<meta name="dcterms.creator" content="" />
<meta name="author" content="" />
<meta name="dcterms.created" title="W3CDTF" content="" />
<meta name="dcterms.publisher" content="" />
<meta name="dcterms.audience" title="icaudience" content="" />
<meta name="dcterms.spatial" title="ISO3166-1" content="" />
<meta name="dcterms.spatial" title="gcgeonames" content="" />
<meta name="dcterms.format" content="HTML" />
<meta name="dcterms.identifier" title="ICsiteProduct" content="536" />

<meta http-equiv="X-UA-Compatible" content="IE=edge">

<meta content="width=device-width,initial-scale=1" name="viewport">

<meta name = "format-detection" content = "telephone=no">

<meta name="robots" content="noarchive">

<link href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/favicon.ico" rel="icon" type="image/x-icon">
<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/wet-boew.min.css">

<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/theme.min.css">

<link rel="stylesheet" href="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/css/noscript.min.css" />

<link rel="stylesheet" href="/eic/home.nsf/css/add_WET_4-0_Canada_Apps.css">

  	<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
  	<link href="/app/ccc/srch/css/print.css" media="print" rel="stylesheet" type="text/css" />

<meta property="legalName" content="Department_of_Industry">

Skip to main content

Skip to "About this site"

Language selection

Français

<object type="image/svg+xml" tabindex="-1" data="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/sig-blk-en.svg"></object> Government of Canada

Search and menus

Search and menus

Topics menu

Jobs

Immigration

Travel

Business

Benefits

Health

Taxes

More services

You are here:

Home

Industries and Business

Canadian Company Capabilities

<input id="showMore" type="hidden" value='more'/>
<input id="showLess" type="hidden" value='less'/>

 Company profile - Canadian Company Capabilities

New Search |

<form name="searchForm" method="post" action="/app/ccc/srch/bscSrch.do">

          <input type="hidden" name="lang" value="eng" />
          <input type="hidden" name="profileId" value="" />
          <input type="hidden" name="prtl" value="1" />
          <input type="hidden" name="searchPage" value="%2Fapp%2Fccc%2Fsrch%2FcccBscSrch.do%3Flang%3Deng%26amp%3Bprtl%3D1%26amp%3Btagid%3D"  />

          <input type="hidden" name="V_SEARCH.scopeCategory" value="CCC.Root" />

          <input type="hidden" name="V_SEARCH.depth" value="1" />
          <input type="hidden" name="V_SEARCH.showStricts" value="false" />
          <input id="repeatSearchBtn" class="btn btn-link" type="submit" value="Return to search results" />

  </form>

| Previous Company

| Next Company

      Third-Party Information Liability Disclaimer

Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.

      Dr. Carole Henri

Legal/Operating Name:

Dr. Carole Henri

enviro@chhsp.com

Mailing Address:

              	<address class="mrgn-bttm-md">

                   201 Pine St

                    SUDBURY,

                    Ontario

                  P3C 1N4

                </address>

Location Address:

              	         <address class="mrgn-bttm-md">

                   201 Pine St

                    SUDBURY,

                    Ontario

                  P3C 1N4

                         </address>

Tel.:
		      (647) 567-1904

Fax:

Company Profile

            ENVRIONMENTAL HEALTH SAFETY CONSULTING

Dr Carole Henri raises Environmental Health and Safety, quality for the 21st Century.

	         - We have over 126 years of combined experience in Environmental Health Safety Consulting;

	         - We are the first company to introduce "Environmental Home Inspection" in Ontario

	         - We are also the first company to introduce "Cold Flash Sterilization" in Ontario and Canada

	         - We are also the first company to introduce "Infrared and Thermo Imaging"  to the education                                 	            for "First Nation/Metis of Ontario and Quebec"

Dr Carole Henri's Vision is to advance the performance, environmental, health and safe of international workplaces and obtain exemplary partnerships.  Dr Carole Henri facilitates corporate leaders/ stakeholders with an Accredited Environment Health Safety Professional to ensure due diligence is served. Heightening attention in these regards will increase proficiency, securing a competitive economy and improve capital investments within the all Construction, Institutional, Educational, Industrial, Hospitality, Food, Manufacturing, and Mining sector. Vigilance to this fundamental business function provides widespread benefits to all concerned.

"Environmental Home Inspection"  the first home inspection that can actually provide you with real time proof that demonstrates deficiencies within your home and/or building

	          - Real Estate

	          - Mortgage Insurer

	          - Bank Managers

	          - Appraisers

                        - Sellers / Buyers

"Cold Flash Sterilization" the first cold sterilizations which eliminate anything from bacteria, viral, microorganism, bed bugs to mold; industrial oil, grease, tailings, mucking

	          - Hospitals

	          - Nursing Homes, Assistant Living, Retirement Homes

	          - Schools

	          - Public Places

	          - Air Planes

	          - Heavy Equipment, Mining Equipment

	          - Forensic

 	          - BED BUGS

 "Infrared and Thermo Imaging"; the first to empower our clients and "First Nation/Metis of Ontario and Quebec" with state of the art scientific instruments.  Our client's experiences are nothing short of amazed

as they can allocate the tissues and expedite solutions, to return on track without loose of revenue, production and/or interruptions

	          - Electrical

	          - Plumping

	          - Hydro Lines

                        - Pipe Lines

	          - Fires / Smoke / Forensic Site

	          - Machinery

We master our work and writing technical environmental and health/safety documents

                        - Courts

                        - Law Firms

                        - Corporate Companies

                        - Manufacturing Companies

                        - To gain new adventures

We value your company and confidentiality and discretions is assured

				Full profile

				Full profile

				Contact information

                Carole
                Henri

	                  Title:

  						Data Provider

                  Telephone:

                (705) 521-4969

                    Email:

                  carole_henri@vianet.ca

  top of page

				Company description

            Country of Ownership:

              Canada

              Year Established:

            1995

            Exporting:

              No

                Primary Industry (NAICS):

				541990 - All Other Professional, Scientific and Technical Services

            Alternate Industries (NAICS):

            541620 - Environmental Consulting Services

            541690 - Other Scientific and Technical Consulting Services

            561410 - Document Preparation Services

            611690 - All Other Schools and Instruction

            Primary Business Activity:

            Services

				Product / Service / Licensing

                              Service Name:

                            HEALTH SAFETY CONSULTING

                            •

                              Service Name:

                            TRAINING

                            •   - Create, Design, implement and maintain training programs as needed. Train employees, contractors, and trainers.

   - Indoctrination PPP and/or manual for visitors, contractors and new employees.

   - MTCU approved trainer

                              Service Name:

                            ACCIDENT/INCIDENT INVESTIGATIONS

                            •   - Secure and Manage the Accident Scene

   - Interviews

•   - Fulfill Government Reporting Requirements

•   - Investigate Root Causes

•   - Prepare Report

                              Service Name:

                            ENVIRONMENTAL CONSULTING

                            •    - Surveys

•    - Investigations

•    - Detection•

    - Audit

•    - Analytical Report

•

MTCU approved Trainer

  top of page

					Sector information

                Key / Major clients:

              Demolition;

FARH Holdings Copr.

ToTal Demoltion

Reclaim Enterprise Ltd

Rainbow Mechanical Services Ltd

City of North Bay

CPM Maintenance/Group

CDJ Associates

Mines;

VALE INCO [INCO]     FNX      XTRATA  [FALCONBRIDGE]

Industrial:

A1 MOBILE MACHINING

VANDERGEETS

AUBURN [sub contract]

ANMAR [sub contract]

HANKIN [sub contract]

COMSTOCK

B&L MOBILE WASH

METAL AIR

BAY AREA ELECTRICAL

SHIPMAN ELECTRICAL

WHITTAKER PLUMBING

METTLER TOLEDO SCALES

TERRATEC ENVIRONMENT

E.S. FOX Ltd

Construction;

RONA

FORIGO CARPENTRY

LEO ALLAIR

TATE

PIONEER

E.S. FOX Ltd

Aerospace/Airlines:

AIR CANADA

MED-AEROSPACE SERVICES

IMAGINE POWER CORP

Health;

LAURENTAIN HOSPITAL

MEMORIAL HOSPITAL

ST JOSEPH HOSPITAL

OPS-TECHONOLOGIES

BEAVER INC.

Fire Department;

PARRY SOUND

Goverment;

GREATER CITY of SUDBURY

PARRY SOUND

water   waste  public works  transfer station  parks and recreation

recycling plant

Manufacturing Automotive [foundry, machining, trim:

BTI

                Success stories:

              On the project site at Lear Corp Windsor Ontario Plant, MOL had put a work stoppage on the gate before the Demolition contractors and sub-contractors had even arrived.

One of the workers had seen my work performance and had past my name along to them.  After receiving a phone call from all the contractors involved, I had a demolition meeting with all the owners.

I explained my call to MOL and stated the reasons and then the contractors stated their story, hence after meeting with the MOL on site, within minutes not only was the work stoppage had been lifted but I had reclassified the intensity of the work involved.

Between all the contractors I managed to save them over a total of millions of dollards

Time and time and again I have saved companies stress, work stoppage but most of all I have saved their profit margins

                Testimonial:

              In their own words...

"Carole's approach to the overhaul of our Health and Safety Program was so comprehensive, I finally feel confident our workplace is as safe as it can possibly be."

Patrick Ouellette

President

OPS-Technologies, Quebec

"I had no idea how complicated my WSIB appeal was going to be until we got into it. Thankfully, we decided early to put Carole on our team. It turned out to be the best decision we could have made!"

Pascal Savard

Safety Director

Beaver Logistic

"Carole is well equipped with her knowledge, expertise and experience which allowed her to just take control of our Health & Safety Emergency.  Carole also took the time to empower us with all the tools we needed to maintain our Health & Safety Department."

Paul & Suzette Gratton

Owner

A1MOBILE MACHINING

"I was so scares to do anything, till you came along and took direction and control of the situation at hand, Thank you Carole"

Denise Belanger				     Director Of Operations				  Recycling Depot/Transfer Station		                            Greater City of Sudbury

"I would not trust anybody else with my life, Carole rides the line of the OH&S Act, she enforces the MOL Regulations, sticks within the guidelines of the WSIB and accepts only CSA standards."

Bill					        Health & Safety Supervisor			 Falconbridge

"We hired a corporate company to act as our Confined Space Policing during our Shut Down, however because of all the deficiencies that were overlook, we retained Carole as our Confined Space Supervisor for one of our project. This year we were accident, fatality free.  Thank you Carole."

Brian Marshal				     Director of Operation Smelter			          INCO

"You are a life saver"

Brian Fisher				    Manager of Environmental Services		             The Town of Parry Sound

"This was all complicated and we could not of done this on our own, Carole I am so happy that you made what was impossible for us something very simple and easy to adapt into our workplace"

Jim Bernas

 Waste Water Treatment Plant, OOR		            The Town of Parry Sound

"We are so in good hands and feel safer since you are here"

Employees and Union President

BTI

"When you go to work you must have the power to reeturn home"

Bill Carroll

Superintendent - Vale INCO

"The knowledge and tools I have accummilated from Carole, has my awareness in safety come to the forefront of my life"

John Kotyluk

Development Miner - Vale INCO

                International capital projects:

              Galora Creek Tunnelling Project worth 75million dollars, in a 5.5 billion dollar Glacier project

Inco Smelter Railway Project worth 3 million dollars

FNX Re opening of 3 Mines worth 23 million dollars

FARH Holdings Corp. Demolition worth 4 million dollars

will add more with permission

					Third-Party Information Liability Disclaimer

					Some of the information on this Web page has been provided by external sources. The Government of Canada is not responsible for the accuracy, reliability or currency of the information supplied by external sources. Users wishing to rely upon this information should consult directly with the source of the information. Content provided by external sources is not subject to official languages, privacy and accessibility requirements.

				Contacts

				Contact information

                Carole
                Henri

	                  Title:

  						Data Provider

                  Telephone:

                (705) 521-4969

                    Email:

                  carole_henri@vianet.ca

				Description

				Company description

            Country of Ownership:

              Canada

              Year Established:

            1995

            Exporting:

              No

                Primary Industry (NAICS):

				541990 - All Other Professional, Scientific and Technical Services

            Alternate Industries (NAICS):

            541620 - Environmental Consulting Services

            541690 - Other Scientific and Technical Consulting Services

            561410 - Document Preparation Services

            611690 - All Other Schools and Instruction

            Primary Business Activity:

            Services

				Products, services and licensing

				Product / Service / Licensing

                              Service Name:

                            HEALTH SAFETY CONSULTING

                            •

                              Service Name:

                            TRAINING

                            •   - Create, Design, implement and maintain training programs as needed. Train employees, contractors, and trainers.

   - Indoctrination PPP and/or manual for visitors, contractors and new employees.

   - MTCU approved trainer

                              Service Name:

                            ACCIDENT/INCIDENT INVESTIGATIONS

                            •   - Secure and Manage the Accident Scene

   - Interviews

•   - Fulfill Government Reporting Requirements

•   - Investigate Root Causes

•   - Prepare Report

                              Service Name:

                            ENVIRONMENTAL CONSULTING

                            •    - Surveys

•    - Investigations

•    - Detection•

    - Audit

•    - Analytical Report

•

MTCU approved Trainer

					Sector

					Sector information

                Key / Major clients:

              Demolition;

FARH Holdings Copr.

ToTal Demoltion

Reclaim Enterprise Ltd

Rainbow Mechanical Services Ltd

City of North Bay

CPM Maintenance/Group

CDJ Associates

Mines;

VALE INCO [INCO]     FNX      XTRATA  [FALCONBRIDGE]

Industrial:

A1 MOBILE MACHINING

VANDERGEETS

AUBURN [sub contract]

ANMAR [sub contract]

HANKIN [sub contract]

COMSTOCK

B&L MOBILE WASH

METAL AIR

BAY AREA ELECTRICAL

SHIPMAN ELECTRICAL

WHITTAKER PLUMBING

METTLER TOLEDO SCALES

TERRATEC ENVIRONMENT

E.S. FOX Ltd

Construction;

RONA

FORIGO CARPENTRY

LEO ALLAIR

TATE

PIONEER

E.S. FOX Ltd

Aerospace/Airlines:

AIR CANADA

MED-AEROSPACE SERVICES

IMAGINE POWER CORP

Health;

LAURENTAIN HOSPITAL

MEMORIAL HOSPITAL

ST JOSEPH HOSPITAL

OPS-TECHONOLOGIES

BEAVER INC.

Fire Department;

PARRY SOUND

Goverment;

GREATER CITY of SUDBURY

PARRY SOUND

water   waste  public works  transfer station  parks and recreation

recycling plant

Manufacturing Automotive [foundry, machining, trim:

BTI

                Success stories:

              On the project site at Lear Corp Windsor Ontario Plant, MOL had put a work stoppage on the gate before the Demolition contractors and sub-contractors had even arrived.

One of the workers had seen my work performance and had past my name along to them.  After receiving a phone call from all the contractors involved, I had a demolition meeting with all the owners.

I explained my call to MOL and stated the reasons and then the contractors stated their story, hence after meeting with the MOL on site, within minutes not only was the work stoppage had been lifted but I had reclassified the intensity of the work involved.

Between all the contractors I managed to save them over a total of millions of dollards

Time and time and again I have saved companies stress, work stoppage but most of all I have saved their profit margins

                Testimonial:

              In their own words...

"Carole's approach to the overhaul of our Health and Safety Program was so comprehensive, I finally feel confident our workplace is as safe as it can possibly be."

Patrick Ouellette

President

OPS-Technologies, Quebec

"I had no idea how complicated my WSIB appeal was going to be until we got into it. Thankfully, we decided early to put Carole on our team. It turned out to be the best decision we could have made!"

Pascal Savard

Safety Director

Beaver Logistic

"Carole is well equipped with her knowledge, expertise and experience which allowed her to just take control of our Health & Safety Emergency.  Carole also took the time to empower us with all the tools we needed to maintain our Health & Safety Department."

Paul & Suzette Gratton

Owner

A1MOBILE MACHINING

"I was so scares to do anything, till you came along and took direction and control of the situation at hand, Thank you Carole"

Denise Belanger				     Director Of Operations				  Recycling Depot/Transfer Station		                            Greater City of Sudbury

"I would not trust anybody else with my life, Carole rides the line of the OH&S Act, she enforces the MOL Regulations, sticks within the guidelines of the WSIB and accepts only CSA standards."

Bill					        Health & Safety Supervisor			 Falconbridge

"We hired a corporate company to act as our Confined Space Policing during our Shut Down, however because of all the deficiencies that were overlook, we retained Carole as our Confined Space Supervisor for one of our project. This year we were accident, fatality free.  Thank you Carole."

Brian Marshal				     Director of Operation Smelter			          INCO

"You are a life saver"

Brian Fisher				    Manager of Environmental Services		             The Town of Parry Sound

"This was all complicated and we could not of done this on our own, Carole I am so happy that you made what was impossible for us something very simple and easy to adapt into our workplace"

Jim Bernas

 Waste Water Treatment Plant, OOR		            The Town of Parry Sound

"We are so in good hands and feel safer since you are here"

Employees and Union President

BTI

"When you go to work you must have the power to reeturn home"

Bill Carroll

Superintendent - Vale INCO

"The knowledge and tools I have accummilated from Carole, has my awareness in safety come to the forefront of my life"

John Kotyluk

Development Miner - Vale INCO

                International capital projects:

              Galora Creek Tunnelling Project worth 75million dollars, in a 5.5 billion dollar Glacier project

Inco Smelter Railway Project worth 3 million dollars

FNX Re opening of 3 Mines worth 23 million dollars

FARH Holdings Corp. Demolition worth 4 million dollars

will add more with permission

    Last Update Date 2015-11-30

Date Modified:

      <time>2017-03-02</time>

About government

Contact us

Departments and agencies

Public service and military

News

Treaties, laws and regulations

Government-wide reporting

Prime Minister

How government works

Open government

About this site

Social media

Mobile applications

About Canada.ca

Terms and conditions

Privacy

Top of Page

<object type="image/svg+xml" tabindex="-1" role="img" data="/utils/scripts/_WET_4-0/apps/themes-dist/gcweb/assets/wmms-blk.svg" aria-label="Symbol of the Government of Canada"></object>


text:
from __future__ import absolute_import, division, print_function, unicode_literals

#-----------------------------------------------------------------------------------------------------------------------
# AutoEncoder Grid Search
#-----------------------------------------------------------------------------------------------------------------------

class H2OAutoEncoderGridSearch(object):

    def anomaly(self, test_data, per_feature=False):
        """
        Obtain the reconstruction error for the input test_data.

        :param H2OFrame test_data: The dataset upon which the reconstruction error is computed.
        :param bool per_feature: Whether to return the square reconstruction error per feature. Otherwise, return
            the mean square error.
        :returns: the reconstruction error.
        """
        return {model.model_id: model.anomaly(test_data, per_feature) for model in self.models}

#-----------------------------------------------------------------------------------------------------------------------
# Binomial Grid Search
#-----------------------------------------------------------------------------------------------------------------------

class H2OBinomialGridSearch(object):

    def F1(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the F1 values for a set of thresholds for the models explored.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where
        the keys are "train", "valid", and "xval".

        :param List thresholds: If None, then the thresholds in this set of metrics will be used.
        :param bool train: If True, return the F1 value for the training data.
        :param bool valid: If True, return the F1 value for the validation data.
        :param bool xval: If True, return the F1 value for each of the cross-validated splits.
        :returns: Dictionary of model keys to F1 values
        """
        return {model.model_id: model.F1(thresholds, train, valid, xval) for model in
                self.models}  # dict model key -> F1 score

    def F2(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the F2 for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the F2 value for the training data.
        :param bool valid: If valid is True, then return the F2 value for the validation data.
        :param bool xval:  If xval is True, then return the F2 value for the cross validation data.
        :returns: Dictionary of model keys to F2 values.
        """
        return {model.model_id: model.F2(thresholds, train, valid, xval) for model in self.models}

    def F0point5(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the F0.5 for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the F0point5 value for the training data.
        :param bool valid: If valid is True, then return the F0point5 value for the validation data.
        :param bool xval:  If xval is True, then return the F0point5 value for the cross validation data.
        :returns: The F0point5 for this binomial model.
        """
        return {model.model_id: model.F0point5(thresholds, train, valid, xval) for model in self.models}

    def accuracy(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the accuracy for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the accuracy value for the training data.
        :param bool valid: If valid is True, then return the accuracy value for the validation data.
        :param bool xval:  If xval is True, then return the accuracy value for the cross validation data.
        :returns: The accuracy for this binomial model.
        """
        return {model.model_id: model.accuracy(thresholds, train, valid, xval) for model in self.models}

    def error(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the error for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the error value for the training data.
        :param bool valid: If valid is True, then return the error value for the validation data.
        :param bool xval:  If xval is True, then return the error value for the cross validation data.
        :returns: The error for this binomial model.
        """
        return {model.model_id: model.error(thresholds, train, valid, xval) for model in self.models}

    def precision(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the precision for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the precision value for the training data.
        :param bool valid: If valid is True, then return the precision value for the validation data.
        :param bool xval:  If xval is True, then return the precision value for the cross validation data.
        :returns: The precision for this binomial model.
        """
        return {model.model_id: model.precision(thresholds, train, valid, xval) for model in self.models}

    def tpr(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the True Positive Rate for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the TPR value for the training data.
        :param bool valid: If valid is True, then return the TPR value for the validation data.
        :param bool xval:  If xval is True, then return the TPR value for the cross validation data.
        :returns: The TPR for this binomial model.
        """
        return {model.model_id: model.tpr(thresholds, train, valid, xval) for model in self.models}

    def tnr(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the True Negative Rate for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the TNR value for the training data.
        :param bool valid: If valid is True, then return the TNR value for the validation data.
        :param bool xval:  If xval is True, then return the TNR value for the cross validation data.
        :returns: The TNR for this binomial model.
        """
        return {model.model_id: model.tnr(thresholds, train, valid, xval) for model in self.models}

    def fnr(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the False Negative Rates for a set of thresholds.
        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the FNR value for the training data.
        :param bool valid: If valid is True, then return the FNR value for the validation data.
        :param bool xval:  If xval is True, then return the FNR value for the cross validation data.
        :returns: The FNR for this binomial model.
        """
        return {model.model_id: model.fnr(thresholds, train, valid, xval) for model in self.models}

    def fpr(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the False Positive Rates for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the FPR value for the training data.
        :param bool valid: If valid is True, then return the FPR value for the validation data.
        :param bool xval:  If xval is True, then return the FPR value for the cross validation data.
        :returns: The FPR for this binomial model.
        """
        return {model.model_id: model.fpr(thresholds, train, valid, xval) for model in self.models}

    def recall(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the Recall (AKA True Positive Rate) for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the recall value for the training data.
        :param bool valid: If valid is True, then return the recall value for the validation data.
        :param bool xval:  If xval is True, then return the recall value for the cross validation data.
        :returns: The recall for this binomial model.
        """
        return {model.model_id: model.recall(thresholds, train, valid, xval) for model in self.models}

    def sensitivity(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the sensitivity (AKA True Positive Rate or Recall) for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the sensitivity value for the training data.
        :param bool valid: If valid is True, then return the sensitivity value for the validation data.
        :param bool xval:  If xval is True, then return the sensitivity value for the cross validation data.
        :returns: The sensitivity for this binomial model.
        """
        return {model.model_id: model.sensitivity(thresholds, train, valid, xval) for model in self.models}

    def fallout(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the Fallout (AKA False Positive Rate) for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the fallout value for the training data.
        :param bool valid: If valid is True, then return the fallout value for the validation data.
        :param bool xval:  If xval is True, then return the fallout value for the cross validation data.
        :returns: The fallout for this binomial model.
        """
        return {model.model_id: model.fallout(thresholds, train, valid, xval) for model in self.models}

    def missrate(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the miss rate (AKA False Negative Rate) for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the missrate value for the training data.
        :param bool valid: If valid is True, then return the missrate value for the validation data.
        :param bool xval:  If xval is True, then return the missrate value for the cross validation data.
        :returns: The missrate for this binomial model.
        """
        return {model.model_id: model.missrate(thresholds, train, valid, xval) for model in self.models}

    def specificity(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the specificity (AKA True Negative Rate) for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the specificity value for the training data.
        :param bool valid: If valid is True, then return the specificity value for the validation data.
        :param bool xval:  If xval is True, then return the specificity value for the cross validation data.
        :returns: The specificity for this binomial model.
        """
        return {model.model_id: model.specificity(thresholds, train, valid, xval) for model in self.models}

    def mcc(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the MCC for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the mcc value for the training data.
        :param bool valid: If valid is True, then return the mcc value for the validation data.
        :param bool xval:  If xval is True, then return the mcc value for the cross validation data.
        :returns: The MCC for this binomial model.
        """
        return {model.model_id: model.mcc(thresholds, train, valid, xval) for model in self.models}

    def max_per_class_error(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the max per class error for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the max_per_class_error value for the training data.
        :param bool valid: If valid is True, then return the max_per_class_error value for the validation data.
        :param bool xval:  If xval is True, then return the max_per_class_error value for the cross validation data.
        :returns: The max per class error for this binomial model.
        """
        return {model.model_id: model.max_per_class_error(thresholds, train, valid, xval) for model in self.models}

    def mean_per_class_error(self, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the mean per class error for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the mean_per_class_error value for the training data.
        :param bool valid: If valid is True, then return the mean_per_class_error value for the validation data.
        :param bool xval:  If xval is True, then return the mean_per_class_error value for the cross validation data.
        :returns: The mean per class error for this binomial model.
        """
        return {model.model_id: model.mean_per_class_error(thresholds, train, valid, xval) for model in self.models}

    def metric(self, metric, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the metric value for a set of thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param metric: name of the metric to compute.
        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the metrics for the training data.
        :param bool valid: If valid is True, then return the metrics for the validation data.
        :param bool xval:  If xval is True, then return the metrics for the cross validation data.
        :returns: The metrics for this binomial model.
        """
        return {model.model_id: model.metric(metric, thresholds, train, valid, xval) for model in self.models}

    def roc(self, train=False, valid=False, xval=False):
        """
        Return the coordinates of the ROC curve for a given set of data, as a two-tuple containing the false positive
        rates as a list and true positive rates as a list.

        If all are False (default), then return  the training data.
        If more than one ROC curve is requested, the data is returned as a dictionary of two-tuples.

        :param bool train: If train is true, then return the ROC coordinates for the training data.
        :param bool valid: If valid is true, then return the ROC coordinates for the validation data.
        :param bool xval: If xval is true, then return the ROC coordinates for the cross validation data.
        :returns: the true cooridinates of the roc curve.
        """
        return {model.model_id: model.roc(train, valid, xval) for model in self.models}

    def confusion_matrix(self, metrics=None, thresholds=None, train=False, valid=False, xval=False):
        """
        Get the confusion matrix for the specified metrics/thresholds.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param metrics: A list of metrics or a single metric among ``"min_per_class_accuracy"``, ``"absolute_mcc"``,
            ``"tnr"``, ``"fnr"``, ``"fpr"``, ``"tpr"``, ``"precision"``, ``"accuracy"``, ``"f0point5"``, ``"f2"``,
            ``"f1"``.
        :param thresholds: thresholds parameter must be a list (i.e. [0.01, 0.5, 0.99]). If None, then the thresholds
            in this set of metrics will be used.
        :param bool train: If train is True, then return the confusion matrix value for the training data.
        :param bool valid: If valid is True, then return the confusion matrix value for the validation data.
        :param bool xval:  If xval is True, then return the confusion matrix value for the cross validation data.
        :returns: The confusion matrix for this binomial model.
        """
        return {model.model_id: model.confusion_matrix(metrics, thresholds, train, valid, xval) for model in
                self.models}

    def find_threshold_by_max_metric(self, metric, train=False, valid=False, xval=False):
        """
        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param str metric: The name of the metric to search for.
        :param bool train: If train is True, then return the threshold_by_max_metric value for the training data.
        :param bool valid: If valid is True, then return the threshold_by_max_metric value for the validation data.
        :param bool xval:  If xval is True, then return the threshold_by_max_metric value for the cross validation data.
        :returns: The threshold_by_max_metric for this binomial model.
        """
        return {model.model_id: model.find_threshold_by_max_metric(metric, train, valid, xval) for model in self.models}

    def find_idx_by_threshold(self, threshold, train=False, valid=False, xval=False):
        """
        Retrieve the index in this metric's threshold list at which the given threshold is located.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param float threshold: The threshold value to search for.
        :param bool train: If train is True, then return the idx_by_threshold for the training data.
        :param bool valid: If valid is True, then return the idx_by_threshold for the validation data.
        :param bool xval:  If xval is True, then return the idx_by_threshold for the cross validation data.
        :returns: The idx_by_threshold for this binomial model.
        """
        return {model.model_id: model.find_idx_by_threshold(threshold, train, valid, xval) for model in self.models}

#-----------------------------------------------------------------------------------------------------------------------
# Clustering Grid Search
#-----------------------------------------------------------------------------------------------------------------------

class H2OClusteringGridSearch(object):

    def size(self, train=False, valid=False, xval=False):
        """
        Get the sizes of each cluster.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where
        the keys are "train", "valid", and "xval".

        :param bool train: If True, then return the cluster sizes for the training data.
        :param bool valid: If True, then return the cluster sizes for the validation data.
        :param bool xval: If True, then return the cluster sizes for each of the cross-validated splits.
        :returns: the cluster sizes for the specified key(s).
        """
        return {model.model_id: model.size(train, valid, xval) for model in self.models}

    def num_iterations(self):
        """Get the number of iterations that it took to converge or reach max iterations."""
        return {model.model_id: model.num_iterations() for model in self.models}

    def betweenss(self, train=False, valid=False, xval=False):
        """
        Get the between cluster sum of squares.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where
        the keys are "train", "valid", and "xval".

        :param bool train: If True, then return the between cluster sum of squares value for the training data.
        :param bool valid: If True, then return the between cluster sum of squares value for the validation data.
        :param bool xval: If True, then return the between cluster sum of squares value for each of the
            cross-validated splits.
        :returns: the between cluster sum of squares values for the specified key(s).
        """
        return {model.model_id: model.betweenss(train, valid, xval) for model in self.models}

    def totss(self, train=False, valid=False, xval=False):
        """
        Get the total sum of squares.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where
        the keys are "train", "valid", and "xval".

        :param bool train: If True, then return total sum of squares for the training data.
        :param bool valid: If True, then return the total sum of squares for the validation data.
        :param bool xval: If True, then return the total sum of squares for each of the cross-validated splits.
        :returns: the total sum of squares values for the specified key(s).
        """
        return {model.model_id: model.totss(train, valid, xval) for model in self.models}

    def tot_withinss(self, train=False, valid=False, xval=False):
        """
        Get the total within cluster sum of squares.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where
        the keys are "train", "valid", and "xval".

        :param bool train: If True, then return the total within cluster sum of squares for the training data.
        :param bool valid: If True, then return the total within cluster sum of squares for the validation data.
        :param bool xval: If True, then return the total within cluster sum of squares for each of the
            cross-validated splits.
        :returns: the total within cluster sum of squares values for the specified key(s).
        """
        return {model.model_id: model.tot_withinss(train, valid, xval) for model in self.models}

    def withinss(self, train=False, valid=False, xval=False):
        """
        Get the within cluster sum of squares for each cluster.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where
        the keys are "train", "valid", and "xval".

        :param bool train: If True, then return within cluster sum of squares for the training data.
        :param bool valid: If True, then return the within cluster sum of squares for the validation data.
        :param bool xval: If True, then return the within cluster sum of squares for each of the
            cross-validated splits.
        :returns: the within cluster sum of squares values for the specified key(s).
        """
        return {model.model_id: model.withinss(train, valid, xval) for model in self.models}

    def centroid_stats(self, train=False, valid=False, xval=False):
        """
        Get the centroid statistics for each cluster.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where
        the keys are "train", "valid", and "xval".

        :param bool train: If True, then return the centroid statistics for the training data.
        :param bool valid: If True, then return the centroid statistics for the validation data.
        :param bool xval: If True, then return the centroid statistics for each of the cross-validated splits.
        :returns: the centroid statistics for the specified key(s).
        """
        return {model.model_id: model.centroid_stats(train, valid, xval) for model in self.models}

    def centers(self):
        """Returns the centers for the KMeans model."""
        return {model.model_id: model.centers() for model in self.models}

    def centers_std(self):
        """Returns the standardized centers for the kmeans model."""
        return {model.model_id: model.centers_std() for model in self.models}

#-----------------------------------------------------------------------------------------------------------------------
# Dimensionality Reduction Grid Search
#-----------------------------------------------------------------------------------------------------------------------

class H2ODimReductionGridSearch(object):
    def num_iterations(self):
        """
        Get the number of iterations that it took to converge or reach max iterations.

        :returns: number of iterations (integer)
        """
        return {model.model_id: model.num_iterations for model in self.models}

    def objective(self):
        """
        Get the final value of the objective function from the GLRM model.

        :returns: final objective value (double)
        """
        return {model.model_id: model.objective for model in self.models}

    def final_step(self):
        """
        Get the final step size from the GLRM model.

        :returns: final step size (double)
        """
        return {model.model_id: model.final_step for model in self.models}

    def archetypes(self):
        """
        :returns: the archetypes (Y) of the GLRM model.
        """
        return {model.model_id: model.archetypes for model in self.models}

#-----------------------------------------------------------------------------------------------------------------------
# Multinomial Grid Search
#-----------------------------------------------------------------------------------------------------------------------

class H2OMultinomialGridSearch(object):
    def confusion_matrix(self, data):
        """
        Returns a confusion matrix based of H2O's default prediction threshold for a dataset.

        :param data: metric for which the confusion matrix will be calculated.
        """
        return {model.model_id: model.confusion_matrix(data) for model in self.models}

    def hit_ratio_table(self, train=False, valid=False, xval=False):
        """
        Retrieve the Hit Ratios.

        If all are False (default), then return the training metric value.
        If more than one option is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param bool train: If train is True, then return the hit ratio value for the training data.
        :param bool valid: If valid is True, then return the hit ratio value for the validation data.
        :param bool xval:  If xval is True, then return the hit ratio value for the cross validation data.
        :returns: The hit ratio for this multinomial model.
        """
        return {model.model_id: model.hit_ratio_table(train, valid, xval) for model in self.models}

    def mean_per_class_error(self, train=False, valid=False, xval=False):
        """
        Get the mean per class error.

        If all are False (default), then return the training metric value.
        If more than one options is set to True, then return a dictionary of metrics where the keys are "train",
        "valid", and "xval".

        :param bool train: If train is True, then return the mean per class error value for the training data.
        :param bool valid: If valid is True, then return the mean per class error value for the validation data.
        :param bool xval:  If xval is True, then return the mean per class error value for the cross validation data.
        :returns: The mean per class error for this multinomial model.
        """
        return {model.model_id: model.mean_per_class_error(train, valid, xval) for model in self.models}

#-----------------------------------------------------------------------------------------------------------------------
# Regression Grid Search
#-----------------------------------------------------------------------------------------------------------------------

class H2ORegressionGridSearch(object):
    pass


text:
<?php

namespace Collejo\App\Modules\Students\Presenters;

use Collejo\Foundation\Presenter\BasePresenter;

class StudentClassDetailsPresenter extends BasePresenter
{
    protected $decorate = [
        'pivot'       => StudentClassDetailsPivotDecorator::class,
    ];

    protected $hidden = [
        'created_by',
        'updated_by',
        'created_at',
        'updated_at',
        'deleted_at',
    ];
}