什么是R等价的" C" sklearn的Logistic回归中的参数?

时间:2016-03-18 05:59:50

标签: python r logistic-regression regularized

sklearn python C中,LogisticRegression有一个R参数(正则化参数)。

现在,我想知道glm(<outcome> ~ <covariates>, family="binomial") 语言中的等价物是什么?当我在R中进行逻辑回归时,我这样做:

C

但它对C参数的用途是什么? R用于正规化,但我无法在 <?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <artifactId>repo</artifactId> <name>Alfresco Repository WAR Aggregator</name> <packaging>war</packaging> <description>Alfresco Repository aggregator, installs your repository AMPs in the Alfresco WAR for aggregation and easy deployment purposes</description> <parent> <groupId>au.com.abc.alfresco</groupId> <artifactId>enterprise-all-in-one</artifactId> <version>1.1-SNAPSHOT</version> </parent> <properties> <!-- During development we set log root level to Debug, this will be applicable to the log configuration in repo/src/main/resources/alfresco/extension/dev-log4j.properties, such as DemoComponent logging. --> <app.log.root.level>DEBUG</app.log.root.level> </properties> <dependencies> <dependency> <groupId>${alfresco.groupId}</groupId> <artifactId>${alfresco.repo.artifactId}</artifactId> <version>${alfresco.version}</version> <type>war</type> </dependency> <!-- Demonstrating the dependency / installation of the repo AMP developed in the 'repo-amp' module --> <dependency> <groupId>au.com.abc.alfresco</groupId> <artifactId>abc-repo-common</artifactId> <version>${abc.repo.common.parent.version}</version> <type>amp</type> </dependency> <dependency> <groupId>au.com.abc.alfresco</groupId> <artifactId>abc-repo-common-classes</artifactId> <version>${abc.repo.common.parent.version}</version> <type>jar</type> </dependency> <dependency> <groupId>au.com.abc.alfresco</groupId> <artifactId>abc-repo-bpmf</artifactId> <version>${project.version}</version> <type>amp</type> </dependency> <dependency> <groupId>au.com.abc.alfresco</groupId> <artifactId>abc-repo-batp</artifactId> <version>${project.version}</version> <type>amp</type> </dependency> <dependency> <groupId>au.com.abc.alfresco</groupId> <artifactId>abc-repo-ctp</artifactId> <version>${project.version}</version> <type>amp</type> </dependency> <dependency> <groupId>au.com.abc.alfresco</groupId> <artifactId>abc-repo-life</artifactId> <version>${project.version}</version> <type>amp</type> </dependency> <dependency> <groupId>au.com.abc.alfresco</groupId> <artifactId>abc-repo-mpc</artifactId> <version>${project.version}</version> <type>amp</type> </dependency> <dependency> <groupId>org.alfresco.aos-module</groupId> <artifactId>alfresco-aos-module</artifactId> <version>1.1-65</version> <type>amp</type> </dependency> </dependencies> <build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <!-- Here is can control the order of overlay of your (WAR, AMP, etc.) dependencies | NOTE: At least one WAR dependency must be uncompressed first | NOTE: In order to have a dependency effectively added to the WAR you need to | explicitly mention it in the overlay section. | NOTE: First-win resource strategy is used by the WAR plugin --> <overlays> <!-- Current project customizations. This is normally empty, since customizations come from the AMPs --> <overlay /> <!-- The Alfresco WAR --> <overlay> <groupId>${alfresco.groupId}</groupId> <artifactId>${alfresco.repo.artifactId}</artifactId> <type>war</type> <!-- To allow inclusion of META-INF --> <excludes /> </overlay> <overlay> <groupId>${project.groupId}</groupId> <artifactId>abc-repo-bpmf</artifactId> <type>amp</type> </overlay> <overlay> <groupId>${project.groupId}</groupId> <artifactId>abc-repo-common</artifactId> <type>amp</type> </overlay> <overlay> <groupId>${project.groupId}</groupId> <artifactId>abc-repo-batp</artifactId> <type>amp</type> </overlay> <overlay> <groupId>${project.groupId}</groupId> <artifactId>abc-repo-ctp</artifactId> <type>amp</type> </overlay> <overlay> <groupId>${project.groupId}</groupId> <artifactId>abc-repo-life</artifactId> <type>amp</type> </overlay> <overlay> <groupId>${project.groupId}</groupId> <artifactId>abc-repo-mpc</artifactId> <type>amp</type> </overlay> <overlay> <groupId>org.alfresco.aos-module</groupId> <artifactId>alfresco-aos-module</artifactId> <type>amp</type> </overlay> </overlays> </configuration> </plugin> </plugins> </build> <profiles> <!-- Overrides the run profile to disable securecomms and add rapid development configuration --> <profile> <id>run</id> <build> <plugins> <plugin> <artifactId>maven-war-plugin</artifactId> <executions> <execution> <id>prepare-exploded-war</id> <goals> <goal>exploded</goal> </goals> <phase>prepare-package</phase> </execution> <execution> <id>default-war</id> <!--<configuration> <webXml>${project.build.directory}/${project.build.finalName}-nossl/WEB-INF/web.xml</webXml> </configuration> --> </execution> </executions> </plugin> <!-- Replaces web.xml where applicable, commenting out the security-constraints --> <plugin> <groupId>com.google.code.maven-replacer-plugin</groupId> <artifactId>replacer</artifactId> <executions> <execution> <id>disable-securecomms</id> <phase>prepare-package</phase> <goals> <goal>replace</goal> </goals> </execution> </executions> <configuration> <ignoreErrors>true</ignoreErrors> <file>${project.build.directory}/${project.build.finalName}/WEB-INF/web.xml</file> <outputDir>${project.build.directory}/${project.build.finalName}-nossl/WEB-INF/</outputDir> <preserveDir>false</preserveDir> <replacements> <replacement> <token> <![CDATA[<!-- Toggle securecomms placeholder start -->]]> </token> <value> <![CDATA[<!--]]> </value> </replacement> <replacement> <token> <![CDATA[<!-- Toggle securecomms placeholder end -->]]> </token> <value> <![CDATA[-->]]> </value> </replacement> </replacements> </configuration> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>org.alfresco.maven</groupId> <artifactId>alfresco-rad</artifactId> <version>${maven.alfresco.version}</version> </dependency> </dependencies> </profile> </profiles> </project> 中找到任何此类等效项?

以下是我检查的一些地方:

http://data.princeton.edu/R/glms.html

1 个答案:

答案 0 :(得分:1)

在R中,GLM中没有实现正则化。您可以在R中使用Liblinear包进行正则化回归。链接https://cran.r-project.org/web/packages/LiblineaR/LiblineaR.pdf是Liblinear包的手册。它只有10页的文件。你可以很快地完成它。

我认为它是python中逻辑回归的壁橱。

就您的问题而言,您可以查看cost参数。在该文件中,据说该参数是正则化参数,即C参数。