This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class OnboardingCollectionViewCell: UICollectionViewCell { | |
static let reuseIdentifier = "OnboardingCell" | |
@IBOutlet weak var pageImage: UIImageView! | |
@IBOutlet weak var pageTitle: UILabel! | |
@IBOutlet weak var pageDescription: UILabel! | |
@IBOutlet weak var startButton: UIButton! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class OnboardingCollectionViewController: UICollectionViewController { | |
private let pages = OnboardingModelFactory.getPages() | |
private lazy var pageControl: UIPageControl = { | |
let pageControl = UIPageControl() | |
pageControl.numberOfPages = pages.count | |
return pageControl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class OnboardingModelFactory { | |
static func getPages() -> [OnboardingModel] { | |
return [ | |
OnboardingModel(title: "Feature 1", | |
content: "Esta feature faz com que o aplicativo faça coisas incríveis!", | |
iconImage: "iconOnboarding1", | |
backgroundColor: Color.lightPurple, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
struct OnboardingModel { | |
let title: String | |
let content: String | |
let iconImage: String | |
let backgroundColor: UIColor | |
let hideButton: Bool | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class OnboardingCollectionViewCell: UICollectionViewCell { | |
static let reuseIdentifier = "OnboardingCell" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class OnboardingCollectionViewController: UICollectionViewController { | |
} | |
extension OnboardingCollectionViewController: UICollectionViewDelegateFlowLayout { | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
O parâmetro 'max_depth' otimizado para o modelo é 4. | |
Preço estimado para o imóvel 1: $408,870.00 | |
Preço estimado para o imóvel 2: $232,662.50 | |
Preço estimado para o imóvel 3: $892,850.00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cria um regressor (DecisionTree) com o parâmetro 'max_depth | |
# otimizado para os dados de treinamento | |
regressor = fit_model(X_train, y_train) | |
print "O parâmetro 'max_depth' otimizado " \ | |
"para o modelo é {}.\n".format(regressor.get_params()['max_depth']) | |
client_data = [[5, 17, 15], # Imóvel 1 | |
[4, 32, 22], # Imóvel 2 | |
[8, 3, 12]] # Imóvel 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fit_model(X, y): | |
# Gera conjuntos de validação-cruzada para o treinamento de dados | |
cv_sets = ShuffleSplit(X.shape[0] # qt total elementos | |
, n_iter = 10 # qt vezes embaralhar e dividir | |
, test_size = 0.2 | |
, random_state = 123) | |
grid = GridSearchCV(DecisionTreeRegressor() | |
, dict(max_depth = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) | |
, make_scorer(performance_metric) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Misturando e separando os dados em conjuntos de treinamento e teste | |
X_train, X_test, y_train, y_test = train_test_split(features, prices, test_size = 0.2, random_state = 123) | |
print "\nSeparação entre treinamento e teste feita com êxito.\n" |
NewerOlder