首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >在Spark Scala中实现隔离森林

在Spark Scala中实现隔离森林
EN

Stack Overflow用户
提问于 2018-06-19 03:08:12
回答 2查看 1.3K关注 0票数 2

我正在尝试使用Spark Scala Maven项目实现隔离森林算法。它在这个链接上进行了解释:iforest example

我的问题是:当我尝试实现建议的代码时,我收集了这个错误:object iforest is not a member of package org.apache.spark.ml,我尝试import org.apache.spark.ml,并将Spark-core依赖项也更改为Vesrion2.2.0。

<dependency>
    <groupId>org.apache.spark</groupId>
    <artifactId>spark-core_2.11</artifactId>
    <version>2.2.0</version>
</dependency>

有什么建议吗?

EN

回答 2

Stack Overflow用户

发布于 2019-08-17 16:20:58

您可以尝试this Spark/Scala implementation of the isolation forest algorithm,它在公共JCenter存储库中提供了工件。

您可以在您的Maven配置中指定JCenter存储库,方法是定义~/.m2/settings.xml,如下所示(按照"SET ME UP!“按钮here):

<?xml version="1.0" encoding="UTF-8" ?>
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
          xmlns='http://maven.apache.org/SETTINGS/1.0.0' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>

    <profiles>
        <profile>
            <repositories>
                <repository>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <id>central</id>
                    <name>bintray</name>
                    <url>https://jcenter.bintray.com</url>
                </repository>
            </repositories>
            <pluginRepositories>
                <pluginRepository>
                    <snapshots>
                        <enabled>false</enabled>
                    </snapshots>
                    <id>central</id>
                    <name>bintray-plugins</name>
                    <url>https://jcenter.bintray.com</url>
                </pluginRepository>
            </pluginRepositories>
            <id>bintray</id>
        </profile>
    </profiles>
    <activeProfiles>
        <activeProfile>bintray</activeProfile>
    </activeProfiles>
</settings>

然后,您可以在项目的pom.xml中将依赖项声明为:

<dependency>
  <groupId>com.linkedin.isolation-forest</groupId>
  <artifactId>isolation-forest_2.11</artifactId>
  <version>0.3.0</version>
</dependency>
票数 4
EN

Stack Overflow用户

发布于 2018-06-19 03:30:55

这个spark-iforest工件没有包含在官方发行版中,也没有出现在任何集中的工件发行版资源中,所以要使用它,您需要自己构建它,或者作为一个单独的库,或者在您的项目中。

这个库一开始不应该使用外部源的包名,因为它提供了一个错误的提议,即它在Spark本身中是可用的。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50916005

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档